In order for viewWillAppear
and viewDidAppear
to function properly in a tab bar controller, you'll want to be sure to call those methods when you display the tab bar controller itself. That is, if you are creating your UITabBarController
programmatically, be sure to call those methods:
UITabBarController *myTabBarController = [[UITabBarController alloc] init];
[myTabBarController setViewControllers:myViewControllerArray];
[myTabBarController viewWillAppear:NO];
[[self view] addSubview:[myTabBarController view]];
[myTabBarController viewDidAppear:NO];
If your tab bar controller is being created in a NIB file, this doesn't apply - and in that case I'm not sure why your viewDidAppear
method would not be called automatically.