tags:

views:

246

answers:

2

It doesn't seem like each time a view is presented via the tab bar, that the viewDidAppear method gets called. I've searched as much as I could on this issue, but haven't really found a definitive answer.

Are there any suggestions or workarounds to this?

A: 

I personally use the viewWillAppear:(BOOL)animated method.

James Raybould
+1  A: 

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.

pix0r