![](/img/trans.png)
[英]Swift: How to segue between view controllers and use navigation bar to go backwards within a child view controller (XLPagerTabStrip)
[英]How to segue to one view controller from multiple navigation controllers and when done go back to whichever view controller presented it swift
您只需要調用popViewController
即可popViewController
viewcontroller。 它會自動跟隨由導航控制器A或B創建的導航堆棧。
如果要彈出到第一個viewcontroler,則可以調用popToRootViewController
。
希望這會有所幫助:)
只需為導航控制器設置情節提要ID,一旦到達最終視圖控制器即可。 只需使用:
self.performSegueWithIdentifier(identifier: String, sender: AnyObject?)
使用prepareForSegue轉到所需的NavigationViewController
設置一個Bool值並將其從“導航”視圖控制器傳遞出去,同時遍歷到最后一個視圖控制器。 例如,從Nav A轉到時傳遞true,從Nav B轉到時傳遞false。一旦到達最終的ViewController,請使用以下布爾值:
if boolValue == true {
self.performSegueWithIdentifier(identifier: "identifierforNavA", sender: AnyObject?)
}
else {
self.performSegueWithIdentifier(identifier: "identifierforNavB", sender: AnyObject?)
}
不要忘了實現prepareForSegue以便performSegueWihIdentifier起作用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.