1

基本上我在视图控制器中有一个标签栏。我正在尝试检测是否在视图控制器 2 中触摸了此 tabaritem。执行此类任务的最佳方法是什么?如果您愿意,我可以发布更具体的代码。

视图控制器 1

  TUHomeViewController *homeViewController = [[TUHomeViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *homeNavigationController = [[UINavigationController alloc] initWithRootViewController:homeViewController];
homeNavigationController.tabBarItem = [[DSTabBarItem alloc] initWithFinishedSelectedImage:[UIImage imageNamed:@"home"] 
                                                            finishedUnselectedImage:[UIImage imageNamed:@"home1"]
                                                                                 iconSize:CGSizeMake(76, 59)
                                                                                tag:0];
[tabBarViewControllers addObject:homeNavigationController];

视图控制器 2

4

2 回答 2

0

您应该使用 UITabBarControllerDelegate。请参阅:http: //developer.apple.com/library/ios/#documentation/uikit/reference/UITabBarControllerDelegate_Protocol/Reference/Reference.html

更具体地说,看

tabBarController:didSelectViewController:

“告诉代理用户在标签栏中选择了一个项目。”

于 2013-03-19T16:17:52.197 回答
0

使用委托 didselectviewcontroller 并将 tabbarcobtroller 的委托给自己

于 2013-03-19T16:21:17.670 回答