![](/img/trans.png)
[英]Programmatically push to view controller [2] in a navigation stack, and unwind to [1]
[英]How can I push the next view controller on a navigation controller programmatically?
如何以編程方式(無需按鈕)將下一個視圖控制器按入導航控制器?
我知道如何實例化並呈現一個新的控制器如下
var next = self.storyboard?.instantiateViewControllerWithIdentifier("PlaceInfo") as! PlaceInfoController
self.presentViewController(next, animated: false, completion: nil)
但我想推送到導航控制器上的下一個視圖控制器。 我嘗試了下面的self.navigationController?.pushViewController()但沒有成功
var next = self.storyboard?.instantiateViewControllerWithIdentifier("PlaceInfo") as! PlaceInfoController
self.navigationController?.pushViewController(next, animated: true)
您是否嘗試過使用performSegueWithIdentifier
?
在此處了解更多有關此的信息:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.