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
var next = self.storyboard?.instantiateViewControllerWithIdentifier("PlaceInfo") as! PlaceInfoController
self.navigationController?.pushViewController(next, animated: true)
Have you tried using performSegueWithIdentifier
?
Learn more about this here:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.