0
我需要从应用程序的委托选项卡上选择索引并调用视图控制器的功能,该选项卡中的故事板如何在appdelegate的选项卡视图中调用控制器。故事板
(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
}
}
UITabBarController * tabb =(UITabBarController *)self.window.rootViewController; tabb.delegate = self; UIViewController * controller = [tabb.viewControllers objectAtIndex:2]; if(controller!= nil){controller LoadSpecialsWebsite]; } –
继承人我的代码AppDelegate.m但我得到这个错误: - [UINavigationController的LoadSpecialsWebsite]:无法识别的选择发送到实例 的UITabBarController *塔布=(*的UITabBarController)self.window.rootViewController; 的UIViewController *控制器= [tabb.viewControllers objectAtIndex:2]; if(controller!= nil){controller LoadSpecialsWebsite]; } //SpecialsViewController.m - (无效)LoadSpecialsWebsite { 的NSLog(@ “LoadSpecialsWebsite”); } –
确定执行以下操作 的UITabBarController *塔布=(的UITabBarController *)self.window.rootViewController; UINavigationController * controller = [tabb.viewControllers objectAtIndex:2]; if(controller!= nil){[controller.viewControllers.lastObject LoadSpecialsWebsite]; } // // SpecicalViewController.m - (void)LoadSpecialsWebsite {NSLog(@“LoadSpecialsWebsite”); } –