I have a UITabController in my main window, and would like to add some logic when each tab is selected. I’ve added the delegate to the header file:
@interface MyAppAppDelegate : NSObject <UIApplicationDelegate, UITabBarDelegate> {
I have a method for the tab change event:
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item{
//some code
}
But the code inside the didSelectItem method isn’t called. I’ve connected the delegate for the UITabBarController to my AppDelegate in IB. Is there anything else I need to do?
I ended up putting it in the viewWillAppear method of the view in the specific tab I need. Seems to work fine.