Display Images In TabBar Application In iPad

This is the very easy example . We will see how to  image display in the different tab in the TabBarApplication using only Interface Builder.

Step 1: Create a TabBar Application using template. Give the application name “TabBarApplication_iPad”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: Xpand classes and notice Interface Builder created the TabBarApplication_iPadViewController class for you. Expand Resources and notice the template generated a separate nib,TabBarApplication_iPadViewController.xib, for the “TabBarApplication_iPad”.

Step 4: We need to add two images in the Resource folder. Give the images name “1.png”, “2.png”.

Step 5: Double click the FirstView.xib file and open it to the Interface Builder. First drag the UIImageView from the library and place it to the View window. Select the UIImageView from the view and bring up Attribute Inspector and select the “1.png”. Connect File’s Owner icon to the View icon and select the view. Save the .xib file and go back to the Xcode.

Step 6: Double click the SecondView.xib file and open it to the Interface Builder. First drag the UIImageView from the library and place it to the View window. Select the UIImageView from the view and bring up Attribute Inspector and select the “2.png”. Connect File’s Owner icon to the View icon and select the view. Save the .xib file and go back to the Xcode.

Step 7: Now compile and run the application in the Simulator.

You can Download SourceCode from here TabBarApplication_iPad

Leave a Comment: