【发布时间】:2012-08-10 18:35:34
【问题描述】:
我正在使用基于 tabBar 的 iPhone 应用程序。
- 标签栏控制器中有 5 个 UIViewController。
- 在我的应用程序中,我使用了 APNS。收到 APNS 后,我想更新
UIViewController4 中的数据。 - 如果用户在
UIViewControllers 1,2,3 和 5 中工作,我想更新UIViewController4 中的数据并显示徽章。 - 我刷新并更新了 UIViewController 4 中的数据,但如果用户不在
UIViewController4 中,我想显示徽章。 - 如果用户当前在
UIViewController4 我不想显示徽章。
我如何从其他UIViewController 中找到另一个UIViewController 处于活动或非活动状态?
编辑
我试过下面的代码来获取UITabBarController的selectedIndex。
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSLog(@"%d", appDelegate.tabBarController.selectedIndex);
【问题讨论】:
-
你不能用标签栏的'selectedViewController'属性来获取它吗?
标签: iphone ios uinavigationcontroller uitabbarcontroller badge