viewDidAppear/viewWillAppear
When you push or pop a view controller on/off a navigaction controller's stack, the usual
@interface RootViewController : UIViewController <UINavigationControllerDelegate> {
UINavigationController *navController;
}
Then implement these two methods:
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[viewController viewWillAppear:animated];
}
- (void)navigationController:(UINavigationController *)navigationController
didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[viewController viewDidAppear:animated];
}
Be sure to set the root view controller as the delegate for the nav controller. Now
If you want to call the viewWillDisappear/viewDidDisappear methods, your view controller still has to do that manually before popping itself off the nav stack.