Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6558773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:14:28+00:00 2026-05-25T13:14:28+00:00

I have a UIView that I’m sliding in using a UIScrollView. Code looks like

  • 0

I have a UIView that I’m sliding in using a UIScrollView. Code looks like this:

[view setObject:object]; // updates a bunch of labels, images, etc
[scrollView addSubview:view];
[scrollView setContentOffset:CGPointMake(320,0) animated:YES];

Problem is, the scrollView doesn’t seem to wait for the view to be completely loaded before animating its contentOffset, and so the animation is kinda jerky (almost non-existent on the first slide-in and on older devices). Oddly enough, switching the 3rd line to this fixes it:

[UIView animateWithDuration:0.3 animations:^{
    [scrollView setContentOffset:CGPointMake(320,0) animated:NO];
}];

No lag whatsoever, perfectly smooth slide-in. However, this doesn’t trigger any of the UIScrollViewDelegate calls, on which I also depend (but which aren’t responsible for the lag).

Any idea of how I could tell the UIScrollView to wait for the view to be completely loaded before animating its contentOffset? Or maybe there’s something else that I’m missing?

EDIT: before anyone else suggests it: yes, I did try:

[self performSelector:@selector(slideIn) withObject:nil afterDelay:1];

just to see if it would fix it. And yes it does fix the lag, but this is not an actual solution. performSelector:afterDelay: is never a solution, it’s only a superficial fix. Plus, you’re making the user wait extra seconds every time (since the actual delay may be much shorter than 1 second depending on the device model).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:14:29+00:00Added an answer on May 25, 2026 at 1:14 pm

    Performing selector after delay 0.01 works because the invocation is scheduled on the runloop vs. calling the method immediately. For that matter, afterDelay:0.0 may also work. Did not try in this particular case but works in may similar situations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIView class that I am using to have a CALayer. This
I have a UIView subclass that draws a simple rectangle with this code: -
I have an UIView that is used for overlaying a cameraPicker. Into this View,
I have a UIView that updates based on data in a certain object. I'd
I have a UIView that I would like to animate a flip up. This
I currently have a UIView / UIScrollView that is displayed within a modal view.
I have a UIView that contains a number of CALayer subclasses. I am using
I have a UIView that contains a UIScrollView and I want to be able
I have a UIView that I am trying to render into a UIImage using
I have this UIView that I subclassed and implemented my own drawRect method. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.