Storyboard in iPhone

Introduction

In this article we create a single view application. Here we use a storyboard in place of xib. To move from one view to another view, we create another viewcontroller class. To do this we add a uiviewcontroller class and perform the following.

Select the appdelegate.m class and right-click on it ->choose new file ->select Objective C class ->click on next ->by default the class name ViewController is shown when you choose subclass UIViewController, change the name to what you want. If you want to use xib then mark on it -> click on next -> select the location where you import the view controller class in the project.

In this article I use two buttons and two labels from outlet and add it to the story board. To better understand use the following instructions.

Step 1

Select Xcode and go to the file menu.

create-project-in-iphone.jpg

Step 2

Create a New XCode Project by clicking on it.

Step 3

Now select Single View Application and click on Next.

Step 4

Now provide your Product Name and click on Next.

project-name-in-iphone.jpg

Step 5

Select the location where you want to save your project and click on Create.

Step 6

Now we add the UIViewController Class:

storyboard2-class-in-iphone.jpg

Step 7  

Select storyboard and perform linking:

select-action-segue-in-iphone (1).jpg

Here we select the button using the mouse and press the right mouse button to perform linking or select action modal.

connect-button2-to-screen1-in-iphone.jpg

Do the same for button 2.

Step 8

Now select which Platform you want to see output for.

run-in-iphone.jpg

Output

Output 1 in iPhone

output1-in-iphone.jpg

Output 2 in iPhone

output2-in-iphone.jpg


Similar Articles