如何从App委托导航内部视图控制器

时间:2016-06-27 04:50:28

标签: ios swift apple-push-notifications swrevealviewcontroller

在我的应用委托中,这是我导航到SWRevealViewController

的方式
let revealViewController = mainStoryboard.instantiateViewControllerWithIdentifier("RevealView") as? SWRevealViewController


        self.window!.rootViewController = revealViewController
        self.window?.makeKeyAndVisible()

我从SWRevealViewController的{​​{1}}导航到那个内部视图控制器。

FrontViewcontroller

现在在let secondViewController = self.storyboard?.instantiateViewControllerWithIdentifier("Read") as! ReadViewController secondViewController.title = self.selectedTitle self.navigationController?.pushViewController(secondViewController, animated: true) 收到推送通知时,我想要导航AppDelegate。当我点击后退按钮时,它应该回到ReadViewController,就像它以正常方式发生一样。如何在FrontViewController的通知代理中执行此操作 请帮我。 感谢

1 个答案:

答案 0 :(得分:0)

试试这个:

let yourVC = mainStoryboard.instantiateViewControllerWithIdentifier("Read") as! ReadViewController

let frontViewController = mainStoryboard.instantiateViewControllerWithIdentifier("frontViewController") as! FrontViewController

let navController = UINavigationController()
navController.viewControllers  = [yourVC,frontViewController]

self.window!.rootViewController = navController
self.window?.makeKeyAndVisible()