4thSpace
4thSpace

Reputation: 44312

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?

Upvotes: 5

Views: 3880

Answers (2)

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.

Upvotes: 11

kennytm
kennytm

Reputation: 523304

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

Upvotes: 1

Related Questions