这个问题可能看起来有点傻,但我一直在寻找一段时间的答案,但我找不到答案。所以我正在开发一个在客户端之间集成 Parse 推送通知的应用程序。该应用程序在应用程序中有一个UITabBarController
(TabBarViewController
作为自定义类),storyboard
并且在应用程序的某个时间点(在应用程序关闭时收到推送)我必须将其设置TabBarViewController
为我RootViewController
的进一步操作,例如[TabBarController doSomething];
总之,我试图显示我的第三个选项卡(索引:2)TabBarViewController
并执行在TabBarViewController
类中找到的函数以在第三个选项卡的视图中显示内容。
我正在尝试执行以下操作:
在我的 AppDelegate.m 中的 didFinishLaunchingWithOptions: 方法中:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
TabBarViewController* tabBarController = (TabBarViewController*)[storyboard instantiateViewControllerWithIdentifier:@"<StoryboardIDofTabBarViewController>"];
tabBarController.selectedIndex = 2;
self.window.rootViewController = tabBarController;
[self.window makeKeyAndVisible];
[tabBarController doSomething];
我有一种感觉,该解决方案需要授权,但我真的不知道如何实现它。我的控制器没有嵌入到导航控制器中,所以我不确定是否可以推送TabBarController
.
任何帮助,将不胜感激。谢谢