iOS Development with Xcode – 3

Adding another View to Storyboard

In Tutorial 2, We createt UI Objects by code and worked on UIButtons and labels now lets add another View to Storyboard.
In real life application you would definitely need more than one View to make your application and in Xcode 5 its very easy to add new View Controller to your Storyboard Just Select the View Controller Item from your Utility area and drag it to your Storyboard as shown in the screenshot below.
ios tutorial3

After dragging New View Controller your Storyboard would look like in the screenshot below.
ios tutorial3a

Now Drag a Label to your Second View and write some text inside which shows the message that we are in second view.
Now in your first view click on the button that your have and hold control button and drag your mouse to your second view. You will see a dialog Select Push from that dialog and after that connecting line would be shown between the two view as shown in the screenshot below.
ios tutorial3c

Read More:  Potential Problems and Solutions with Data Security in the Cloud

Well it looks like we are ready the run the app, but when you run the app when your press the Tap button the app would crash.The reason being you are trying to navigate from one view to another view but you don’t have any navigation controller. So, now you have to add Navigation View Controller to your storyboard to do this select your first View and up in the menu bar you would see Editor, click in and from the list go to “Embed In” option and Inside that select “Navigation Controller” and now your storyboard should look like in the screen shot below.
ios tutorial3d
Now You can run it and test navigation from one view to another.

MobileSiri.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. Read about our Affiliates Disclosure Policy here.