Why isn't UIScrollView always calling viewDidLoad on subviews?

Posted by Rob S. on Stack Overflow See other posts from Stack Overflow or by Rob S.
Published on 2010-05-21T18:53:12Z Indexed on 2010/05/21 19:20 UTC
Read the original article Hit count: 409

Filed under:
|
|

I'm a bit confused on the behaviour of UIScrollView as it pertains to subview loading.

In my app, I lazily load subviews into my scroller. Most of the time, -viewDidLoad is called on the subview immediately after adding it the UIScrollView.

There is one scenario where it isn't being called.

At the 'end' of my scroll view I have a "please wait" view. When it is fully scrolled on to the page, it fades out, I add the subview and -viewDidLoad is not called. In this case, when I remove the last subview and add another subview, I get nothing. I've tried [scrollView setNeedsDisplay] and [scrollView setNeedsLayout] to no avail. I've also sent the same messages to the view I just added - no dice.

Does anyone have any insight here? Many people have many questions about -viewDidLoad and I haven't been able to find one related to direct subviews inside of a scrollview. Or I have and I haven't realized it :)

Thanks in advance!

Rob

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiscrollview