我正在我的应用上开发推送通知
。我希望当人们点击推送消息时,应用程序会打开一个特定的 Controller ;
如果我这样做:
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
但 Controller View 覆盖了所有屏幕:标签栏和导航栏被隐藏了!
我知道 rootviewcontroller
是一个 uitabbar
:
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/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |