iphone - viewWillAppear, viewDidAppear,... 4 UIViewController not called.

that's right. with the SDK beta 4 (i don't know about previous versions), the following methods don't appear to get called.

viewWillAppear, viewDidAppear, viewWillDisappear, viewDidDisappear

I created a UINavigationController, pushed a UIViewController with the above methods (with the right method signatures). I can see from the console log that none of the above methods got called.

I also tried creating a UINavigationController with a root viewcontroller that was a UITableViewController. The UITableViewController pushed another UIViewController upon cell selection. Neither table controller nor view controller's view*appear methods got called.

- J

Mac OS X (10.5.2)

Posted on May 1, 2008 1:18 PM

Reply
8 replies

May 8, 2008 7:25 AM in response to jaekwon

It works for me. You might want to make sure your view is actually getting displayed. For example, if you subclass UITableViewController, it has a built in UITableView that will get displayed. If you initialize another UITableView inside the UITableViewController subclass, it's possible to assume that your UITableView is getting displayed, and forget about the built in UITableView, when that's really the one that gets displayed, and not yours. This may not be what you're doing at all, but hopefully it illustrates the point -- if viewWillAppear isn't being called, make sure the view really is being displayed.

Additionally, I vaguely recall doing an early test and noticing that if a view has a subview that is initialized in the view's init method, and you only explicitly display the main view from your app delegate, the subview's viewWillAppear won't get called. Don't quote me on that, though -- there's a very good chance that my memory is playing tricks on me.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

iphone - viewWillAppear, viewDidAppear,... 4 UIViewController not called.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.