如果使用下面的代码点击推送通知,我试图从app delegate打开一个视图控制器
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
if(application.applicationState==UIApplicationState.Inactive ){
let sdViewController = mainStoryboardIpad.instantiateViewControllerWithIdentifier("StudentViewController") as! StudentViewController
let navController = UINavigationController(rootViewController: sdViewController)
navController.setViewControllers([sdViewController], animated:true)
self.window?.rootViewController = navController
}
}
控制器打开,但显示导航的菜单图标不起作用。如何使菜单图标显示侧面导航。
答案 0 :(得分:0)
试试这个
let rootViewController = self.window!.rootViewController as! UINavigationController
rootViewController.pushViewController(sdViewController, animated: true)