Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

viewWillAppear in viewcontrollers of a tabbar

In my tab-bar I have four viewcontrollers, and what happens in one can affect the view of the other, so I may need to reload some elements in the viewcontroller when it becomes visible. Normally I'd fix that by implementing viewWillAppear, but when I switch between the tabs, viewWillAppear does not seem to get called. How can I fix that, or what should I do instead?

Update: as a PS I should add that this is a tabbarcontroller in a navigationcontroller hierarchy

Cheers

Nik

like image 653
niklassaers Avatar asked Jul 17 '10 15:07

niklassaers


2 Answers

You may use the tabbar controller delegate works like a charm

-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
    [viewController viewWillAppear:YES];

}
like image 96
Radix Avatar answered Sep 29 '22 11:09

Radix


Please see my answer here

iPhone viewWillAppear not firing

like image 22
Sam Avatar answered Sep 29 '22 13:09

Sam