ios - 如何从应用程序委托(delegate)导航内部 View Controller

标签 ios swift apple-push-notifications swrevealviewcontroller

在我的应用程序委托(delegate)中,这就是我导航到 SWRevealViewController

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


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

我从 SWRevealViewControllerFrontViewcontroller 导航到该内部 View Controller ,如下所示。

let secondViewController = self.storyboard?.instantiateViewControllerWithIdentifier("Read") as! ReadViewController
        secondViewController.title = self.selectedTitle
        self.navigationController?.pushViewController(secondViewController, animated: true)

现在在 AppDelegate 中,当收到推送通知时,我想导航此 ReadViewController。当我单击后退按钮时,它应该返回到 FrontViewController ,就像正常情况一样。如何在 AppDelegate 的通知委托(delegate)中执行此操作 请帮我。 谢谢

最佳答案

试试这个:

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()

关于ios - 如何从应用程序委托(delegate)导航内部 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38046132/

相关文章:

ios - 如何知道搜索栏文本何时更改

ios - native 模块不暴露给 Javascript 的条件

ios - CoreData OneToMany 错误

iphone - 没有角标(Badge)/警报/声音的 APNS

ios - 有时未收到 Apple 推送通知 (JavaPNS)

ios - addAnnotations 方法仅放置数组中的最后一个注释

ios - 不从方法触发 UIButton 的事件处理程序

swift - 如何将图像放在附加到 NSTextAttachment 类型的 textView 上?

ios - UICollectionView 功能问题

ios - 如何给应用程序图标一个没有数字的通知角标(Badge)?