2017-02-21 35 views
-4

我有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

哦對不起,我會更新它 –

回答

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

和在哪裏調用我的功能,我應該打電話給第三個那裏,因爲我將在那裏進行大量處理 –