iPhone TabBar Application Tutorial - UITabBar


 

iPhone TabBar Application Tutorial - UITabBar

The basic idea behind using a Tab Bar application is to let the user easily browse through the application. In iPhone programming you can see that the UITabBar actually implements a modal interface that change the UIView on tapping it.

The basic idea behind using a Tab Bar application is to let the user easily browse through the application. In iPhone programming you can see that the UITabBar actually implements a modal interface that change the UIView on tapping it.

iPhone TabBar Application Tutorial - UITabBar

The basic idea behind using a Tab Bar application is to let the user easily browse through the application. In iPhone programming you can see that the UITabBar actually implements a modal interface that change the UIView on tapping it. You can have number of Tab Bar items in your application. But it will show max 5 TabBar on the screen.. and rest of them can be seen on tapping the "More..." TabBar item.

UITabBar inherits from UIView : UIResponder : NSObject, and it's FrameWork is UIKit.framework.

In iPhone application, you can create your own customize Tab Bar application. You can also make changes to it by adding, deleting or reordering the tab items. Use a tab bar delegate to augment this behavior.

This tutorial is basically designed for the new comers to the iPhone application development. The tutorial will show you how to create your own UITabBar based application in iPhone and attaching different UIViews to it using Interface builder.

First of all, open the XCode and create a new project -> Tab Bar Application, name the application and save it. Now half of the work is almost done. Just build your application to see the output. It will show you two Tab bar items that is loading two different views on tapping it. First View and Second View.

Now, you can add your own customized UIView to the tab bar... or you can also add more tab bars to it.

Adding more Tab Bars..

Open the "mainView.xib" in interface builder and search "tab bar item" in Library. just drag the item on it and name it in the "Inspector". (Tools -> Inspector, from menu item).

Adding Tab Bar Item

Now, add new file to the project and do some changes into it xib as i placed a Label with text "my third view". And connect it with the tab item that we have just created in "MainView.xib".
Connecting Tab to nib(.xib) file.

Just build your application, and you will that it has added a new tab bar item with the view controller on it. You can also add image to the tab bar items.

Final application will look alike given image...


 

Download Code

Ads