Reputation: 175
I added a tab bar controller programatically, and I want to switch view and hide tab bar controller with the method:
-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
But it is not calling. I add delegate <UITabBarControllerDelegate>
and [myTabBarController setDelegate:self];
in viewDidLoad.
What can I do? Thanks for your reply. Please help..
Upvotes: 2
Views: 678
Reputation: 2884
Try this in your app delegate's didFinishLaunchingWithOptions method:
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
tabBarController.delegate = self;
Upvotes: 1