我使用SWRevealViewController我有一个菜单 菜单中的每个元素在单击
时启动视图控制器(TableViewController)我希望在收到远程推送通知时显示视图
应用程序关闭时的情况:以下代码正常工作
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
// var initialViewController storyboard.instantiateInitialViewController()
let pushViewController = storyboard.instantiateViewControllerWithIdentifier("NewsDetailViewController1") as! UINavigationController
let newsViewController = pushViewController.viewControllers[0] as? NewsDetailViewController
self.window?.rootViewController = pushViewController
self.window?.makeKeyAndVisible()
但是当打开应用程序或后台时我无法启动视图控制器
本案例中使用的代码:
let rootViewController = self.window!.rootViewController
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let setViewController = mainStoryboard.instantiateViewControllerWithIdentifier("NewsDetailViewController1") as! UIViewController
rootViewController?.navigationController?.revealViewController().pushFrontViewController(setViewController, animated: true)
我也用过这个
rootViewController?.navigationController?.pushViewController(setViewController, animated: true)
但没有结果
感谢您的帮助