Here are some ways to programmatically control navigation.
In order to find your view controllers by identifier you will have to first set the identifier (after selecting it on the storyboard):
(Swift 2.2)
In order to find your view controllers by identifier you will have to first set the identifier (after selecting it on the storyboard):
With NavigationController
// Navigate to another view controller let vc = storyboard?.instantiateViewControllerWithIdentifier("myViewController") navigationController?.pushViewController(vc!, animated: true) // Go to previous view controller dismissViewControllerAnimated(true, completion: nil) // Go to the starting view controller navigationController?.popToRootViewControllerAnimated(true)
Without NavigationController
// Navigate to another view controller let vc = storyboard?.instantiateViewControllerWithIdentifier("myViewController") present(vc!, animated: true, completion: nil) // Go to previous view controller dismissViewControllerAnimated(true, completion: nil)
With Segue
// Navigate to another view controller // You have to give your Segue an identifier to use this performSegue(withIdentifier: "mySegue", sender: self)
(Swift 2.2)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.