我有3个ViewControllers,想要在不显示第二个的情况下导航。
实际上我想做这样的事情:
FirstController
覆盖func viewDidLoad(){
super.viewDidLoad()
let secondController = SecondController();
secondController.showThird();
}
SecondController
覆盖func viewDidLoad(){
super.viewDidLoad()
super.didReceiveMemoryWarning()
} func showThird(){
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewControllerWithIdentifier("thirdId")
self.navigationController?.pushViewController(controller, animated: true)
}
ThirdController
覆盖func viewDidLoad(){
super.viewDidLoad()
}
答案 0 :(得分:0)
<强> appdelegate.swift 强>
您可以在没有动画的情况下推送第二个Viewcontroller,然后推送第三个Viewcontroller
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let controllerOne = storyboard.instantiateViewControllerWithIdentifier("oneId")
self.navigationController?.pushViewController(controllerOne, animated: false)
let controllerTwo = storyboard.instantiateViewControllerWithIdentifier("secondId")
self.navigationController?.pushViewController(controllerTwo, animated: false)
let controllerThree = storyboard.instantiateViewControllerWithIdentifier("thirdId")
self.navigationController?.pushViewController(controllerThree, animated: true)
}
希望它适合你。