我正在我的应用程序上开发push notification。我希望人们点击推送消息时,应用打开特定的控制器;

如果我这样做:

storyBoardName = @"MyStoryboardName";
UIStoryboard* storyBoard = [UIStoryboard storyboardWithName:storyBoardName bundle:nil];
MainWebController* MainWeb = [storyBoard instantiateViewControllerWithIdentifier:@"MainWeb"];
MainWeb.urlToLoad = URL_TO_LOAD;
self.window.rootViewController = MainWeb;
[self.window makeKeyAndVisible];

可以,当我点击推式按摩时我可以看到MainWeb,但是控制器视图覆盖了整个屏幕:标签栏和导航栏被隐藏了!

我知道rootviewcontrolleruitabbar:
 NSLog(@"Controller: %@",self.window.rootViewController.debugDescription);

最佳答案

解决:

UITabBarController *tabController = (UITabBarController *)self.window.rootViewController;

tabController.selectedIndex = 0;

UINavigationController *navigationController = (UINavigationController *)tabController.selectedViewController;
[navigationController pushViewController:MainWeb animated:YES];

关于ios - 在didReceiveRemoteNotification中加载特定的 Controller ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19834961/

10-13 03:54