我在appdelegate.m中添加了UITabBarController。请检查以下代码
DiViewController *contact = [[DiViewController alloc] initWithNibName:@"DiViewController" bundle:nil];
UINavigationController *contactNav = [[UINavigationController alloc] initWithRootViewController:contact];
contactNav.navigationBar.barStyle = UIBarStyleBlack;
self.tabController = [[UITabBarController alloc] init];
CGRect tabframe = self.tabController.tabBar.frame;
tabframe.origin.y -= 10;
tabframe.size.height += 10;
self.tabController.tabBar.frame = tabframe;
self.tabController.delegate = self;
self.tabController.viewControllers = @[contactNav];
然后我在模拟器底部标签栏中打开了arun DiViewController.xib。然后我点击了在appdeletgate.m中工作的tabbar item.didSelectViewController。但我想在DiViewController.m。我可以在DiViewController.m中获得didSelectViewController。我在DiViewController.m中使用了以下相同但不起作用。
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
}