简体   繁体   English

如何以编程方式将下一个视图控制器推入导航控制器?

[英]How can I push the next view controller on a navigation controller programmatically?

How can I push the next view controller on a navigation controller programmatically (without the need of a button)? 如何以编程方式(无需按钮)将下一个视图控制器按入导航控制器?

I know how to instantiate and present a new controller is the below 我知道如何实例化并呈现一个新的控制器如下

 var next = self.storyboard?.instantiateViewControllerWithIdentifier("PlaceInfo") as! PlaceInfoController         
 self.presentViewController(next, animated: false, completion: nil)

but I want to push to the next view controller on the navigation controller. 但我想推送到导航控制器上的下一个视图控制器。 I tried the below self.navigationController?.pushViewController() but no success 我尝试了下面的self.navigationController?.pushViewController()但没有成功

 var next = self.storyboard?.instantiateViewControllerWithIdentifier("PlaceInfo") as! PlaceInfoController
 self.navigationController?.pushViewController(next, animated: true)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 以编程方式推送至导航堆栈中的视图控制器[2],然后展开至[1] - Programmatically push to view controller [2] in a navigation stack, and unwind to [1] 我如何将视图控制器推到导航控制器 - how could i push view controller to navigation controller 如何推送不在导航控制器中的视图控制器? 迅速 - How do I push a View Controller that's not in a navigation controller? Swift 以编程方式将视图控制器添加到导航控制器,然后推送另一个视图控制器 - Add viewcontroller to navigation controller programmatically then push another view controller 导航控制器推送视图控制器 - Navigation Controller Push View Controller 如何从详细视图 controller 以编程方式推送视图 controller - How to push a view controller programmatically from Detail view controller 如何使用两个Push Segue在导航控制器中的两个View Controller之间传递数据? - How can I pass data between two View Controllers in a Navigation Controller, with two Push Segue? 如何使用Swift 3以编程方式推送视图控制器 - how to push programmatically made view controller with swift 3 如何以编程方式在视图中嵌入导航控制器? - how to embed navigation controller in a view programmatically? 以编程方式加载后,如何将数据传递给下一个视图控制器? - How can I pass data to the next view controller when it is loaded programmatically?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM