UIViewControllers之间的导航Swift 2.2

问题描述:

我有3个ViewControllers,并希望导航之间,然后不出现第二个。UIViewControllers之间的导航Swift 2.2

我想要做这样的事情究竟是什么:

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

为什么你在didReceiveMemoryWarning()中编写代码? –

+0

哦对不起,我会更新它 –

appdelegate.swift

您可以推动第二的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) 

} 

希望它为你工作。

+0

但在这种情况下,用户不会看到第二个视图reight –

+0

是@ J.Deo你想显示第二个viewController的while? –

+0

和在哪里调用我的功能,我应该打电话给第三个那里,因为我将在那里进行大量处理 –