我需要在app委托的选项卡上选择索引,并在视图控制器中调用选项卡映射到故事板中的函数
(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSString *alertMessage = [[userInfo objectForKey:@"aps"] valueForKey:@"alert"];
if (alertMessage != nil){
UITabBarController *tabb = (UITabBarController *)self.window.rootViewController;
tabb.selectedIndex = 2;
// Need to call a method in my SpecialsViewController which manages properties and functions of tab with index 2
}
}
答案 0 :(得分:0)
执行以下操作
UITabBarController *tabb = (UITabBarController *)self.window.rootViewController;
UIViewController *controller = [tabb.viewControllers objectAtIndex:index_of_your_view_ SpecialsViewController];
[controller call_your_method];
在您的情况下index_of_your_view_ SpecialsViewController = 2