我的初始视图控制器是一个选项卡栏控制器,在选项卡控制器中有多个uinavigationcontrollers,在其中一个uinavigationcontrollers中,会显示一个模式,其中使用另一个uiviewcontrollers流创建另一个uinavigationcontrollers。
我需要通过推送到视图层次结构的“最深”部分来响应应用程序委托中收到的远程通知。
我可以重新创建一个uinavigationcontroller并按名称启动适当的uiviewcontroller,但是它让用户高高在上,无所事事。
有没有办法让用户回到正确的导航流程中?

最佳答案

在我的应用程序代表的DidReceiverEmotentification方法中,我实现这一点的方式是:

let rootTabbarController = self.window?.rootViewController as UITabBarController

let mainStoryboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

let firstNavigationController = mainStoryboard.instantiateViewControllerWithIdentifier("firstNavVc") as UINavigationController

rootTabbarController.viewControllers![0] = firstNavigationController

let vControllerForFirstNavController = (rootTabbarController.viewControllers![0] as UINavigationController).topViewController as MainViewController

let firstDetailsNavController = mainStoryboard.instantiateViewControllerWithIdentifier("detailsNavController") as MainDetailsMenuNavigationController

let detailsVc = firstDetailsNavController.topViewController as MainDetailsViewController

firstNavigationController.presentViewController(firstDetailsNavController, animated: false, completion: nil)

let specificInfoVc = mainStoryboard.instantiateViewControllerWithIdentifier("sDetails") as SpecificDetailsViewController

firstDetailsNavController.pushViewController(specificInfoVc, animated: true)

08-27 07:23