1

The main view (the one shown at launch) for my application is an UIScrollView that contains an UIView. To organize my nibs I'm using this method and everything works fine.

However, when calling scrollRectToVisible:animated in ViewDidLoad in the main view controller (having already set the scrollView's content size) the scrollView doesn't scroll to the indicated CGRect.

There are two strange factors to consider:

  1. The scrollView scrolls as expected on iOS 6 (the problem exposed presents itself on iOS 5).

  2. If I call the code to scroll with a 2 sec delay the scroll happens.

Community
  • 1
  • 1
Francesco
  • 1,047
  • 11
  • 26

1 Answers1

1

Call the scrollRectToVisible:animated in the viewDidAppear:(BOOL)animated.

I solved the same problem with this.

T.M
  • 11
  • 2
  • 4
    Surely that would cause a visible animated scroll / jump. What if you just wanted 'scrollRectToVisible:animated' to adjust the `scrollOffset` before `viewDidAppear:`? – fatuhoku Apr 08 '15 at 12:41