Tuesday 4 April 2017

Navigation Controller to switch between two View




Swift 3.0 : View Controller With Navigation Controller

1. Create New Project
2. SingleView without core data
3. Click on MainStoryBoard. You will see View Controller. 

4. Now click on Object Library ( Right Bottom corner )




5. Click on ViewController and drag it to MainStoryBoard

6. Place One Label(A) and a Button(ViewB) on first ViewController
7. Place One Label(B)on second ViewController




8. Now, Select first ViewController and Goto Editor --> Embed In --> NavigationController




9. Now Click on ViewB button and hold CTRL key and drag it to Second ViewController and leave
10. Action Segue popup showing -- Choose "Show"




11. Now run the app, when you click on ViewB button it showing Second ViewController with Label(B)
12. You also see one BACK button on top NavigationController. Click to back on first ViewController





If you want to add title on ViewController1 and ViewController2

1. Double Click on NavigationCintroller on ViewController1 then add title
2. But when you going to add ViewController2 then not showing show
then go to Widget Library --> Choose Nav Bar and place to ViewController2
3. Now double click to add title.

No comments:

Post a Comment