Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

viewDidAppear for tabbar based apps

I'd like to do something when a particular tab appears. Meaning, the user has clicked the tab view's tab button. viewDidAppear doesn't fire when this happens. How else can I hook into the tab click event?

like image 676
4thSpace Avatar asked May 03 '10 14:05

4thSpace


2 Answers

You can implement this

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

in your Tab Bar Delegate, so your viewDidAppear method will be called properly.

like image 105
Giorgio Marziani de Paolis Avatar answered Oct 14 '22 01:10

Giorgio Marziani de Paolis


Implement -tabBarController:didSelectViewController: in your tab bar delegate.

like image 43
kennytm Avatar answered Oct 14 '22 01:10

kennytm