Sunday 4 December 2016

Navigation Controller using Storyboard - iOS Swift

This code will be really useful to you to change the view controller using Storyboard ID.

For example -
There were 2 view Controllers named FirstViewController and SecondViewController respectively.
If you want to move from FirstViewController to SecondViewController there is a simple Code using Storyboard  ID.

Step 1 :-

Enter the StoryBoard ID for both the ViewControllers

Step 2 :-

Write a code in FirstViewController.
//to navigate to the next view controller with the help of storyboard
let secondVC =  self.storyboard?.instantiateViewControllerWithIdentifier("SecondViewController") as! SecondViewController
self.navigationController?.pushViewController(secondVC, animated: true)

No comments: