viewDidLoad not being called by parent UITabBarController

Posted by Adam Bishop on Stack Overflow See other posts from Stack Overflow or by Adam Bishop
Published on 2010-03-24T02:09:28Z Indexed on 2010/03/24 2:13 UTC
Read the original article Hit count: 798

Sample: I've created a minimal set of files that highlight the issue here: http://uploads.omega.org.uk/Foo3.zip

If viewDidLoad/viewInitWithNibName are called, a message box is displayed. The message box is not displayed, therefore, the methods are not being called.

Details: I have an application that is attempting to use a UITabBarController to switch between multiple views.

The views are linked up to the UITabBarController using interface builder (select the tab page, open Attributes (Option-1), and fill in the NIB Name field), and so are displayed "automatically" with no extra code-behind to make them appear.

Is it intended behaviour that views loaded like this do not have their viewDidLoad method executed? If not, how am I doing it wrong, and what do I need to change.

If it is intended behaviour, I can think of a few work-arounds, but any suggestions are appreciated:

  1. Scrap the UITabBarController and implement the view switching myself (using initWithNibName and add/insert/push/Subview).
  2. Call each of the children's viewDidLoad method manually in the UITabBarController's own viewDidLoad method.

Thank you in advance for any help you can offer.

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about objective-c