iOS Deeplink to a specific ViewController retaining view controller stack

一世执手 提交于 2019-12-11 04:40:02

问题


I'm developing an app for a client of mine and they want to be able to deeplink to a specific view controller from the app being terminated. Here is the current stack:

  • Launch Screen
  • Splash Screen (Here is where we download our config file)
  • VC1
  • VC2
  • VC3
  • VC4
  • VC5

The client wants the ability, via a deeplink, to launch the app, and after the Splash Screen completes the config file download, to navigate to a specific view controller (VC1-VC5). The issue is that they want to retain the stack. So i cannot simply push VC5 from the Splash Screen because VC5 needs the ability to go back to VC4 than VC3 than VC2, etc.

What is the best way to handle this? Any help would be greatly appreciated. Thanks in advance!


回答1:


You can set a navigation stack all at once by using the UINavigationController setViewControllers method. Just create an instance of each view controller and pass them to your nav controller like this:

navController.setViewControllers([vc1, vc2, vc3, vc4, vc5], animated: true)

Just be aware that this will overwrite all view controllers currently in the navigation stack. vc1 would become your navigation controller's root vc.



来源:https://stackoverflow.com/questions/44789439/ios-deeplink-to-a-specific-viewcontroller-retaining-view-controller-stack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!