user141302
user141302

Reputation:

didSelectViewController of tabBarController is not working?

I have implemented Tab bar controller in IB. But when I write the following method in appdelegate.m, it is not called (I have put break point) when i tab.

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item

Upvotes: 0

Views: 4348

Answers (1)

Ben S
Ben S

Reputation: 69342

Wherever you create the UITabBarController, you need to set its delegate property to the custom UITabBarControllerDelegate object you've created.

If you've extended your application delegate to implement the methods of the UITabBarContollerDelegate protocol, and create the UITabBarController in the application delegate, then add the following after creating it:

tabBarVaribleName.delegate = self;

Upvotes: 6

Related Questions