0

我想知道需要什麼代碼來遍歷從位於該被嵌入在一個UITabBarControllerUINavigationController索引N一UIViewController故事板,以類似的嵌入式UIViewControllerUINavigationController的故事板跳頻

我也想所有UIViewController s到源被彈出UINavigationController

直接塞格斯(如以紅色顯示),不符合我的使用情況。

請快。

enter image description here

回答

0

可以彈出到根視圖控制器然後更改標籤欄控制器的索引的選定索引,然後把你需要的其他導航控制器上的任何視圖控制器。例如:

let tabBarController = self.tabBarController; 
    let indexZeroNavController:UINavigationController = self.tabBarController?.viewControllers![0] as! UINavigationController 

    self.navigationController?.popToRootViewControllerAnimated(true) 

    tabBarController?.selectedIndex = 0 

    let newViewController = self.storyboard?.instantiateViewControllerWithIdentifier("New View Controller") 
    let otherNewViewController = self.storyboard?.instantiateViewControllerWithIdentifier("Other New View Controller") 

    indexZeroNavController.pushViewController(newViewController!, animated: true) 
    indexZeroNavController.pushViewController(otherNewViewController!, animated: true) 
0

Beyowulf的方法,曾是有效的,但事情發生了變化。在你想要彈出的viewController中,定義一個「unwind segue」。 example定義後,您可以將按鈕從一個按鈕拖到「退出」並選擇放鬆繼續。

在xcode 7中完全重寫了展開segues工作的方式,因此您不必過多擔心視圖控制器堆棧。

相關問題