Reputation: 1398
AppDelegate.h *****
@interface AppDelegate : UIResponder <UIApplicationDelegate,UITabBarControllerDelegate,UITabBarDelegate>
AppDelegate.m *****
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
NSLog(@"%lu",(unsigned long)tabBarController.selectedIndex);
}
This method not work any idea ? I want to scroll top when click tab bar item Help please :)
Upvotes: 0
Views: 1032
Reputation: 494
You just have to add this line in the viewDidLoad method of your first viewController :
self.tabBarController.delegate = ((AppDelegate *)[UIApplication sharedApplication].delegate);
Upvotes: 1