top of page
  • Writer's pictureJennifer Eve Vega

Tabbed Application, Using Interface Builder

If you want to create a Tabbed Application programmatically, refer to this tutorial:

Let\’s create a Tabbed application using Interface Builder! 😀

1. Create a new empty application. Make your own MainWindow.xib file, you already know how to do this. (If not, refer to this tutorial:

2. Go to AppDelegate.h, add a UITabBarControllerDelegate

@interface AppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>

3. add a UITabBarController property.

@property (strong, nonatomic) UITabBarController *tabBarController;

4. Synthesize your tabBarController variable in AppDelegate.m.

5. Create at least 2 View Controllers, name it First and Second ViewController. Add UILabels and other stuff, to indicate that such UI belongs to either of the two ViewControllers.

6. Add \”IBOutlet\” to UIWindow and UITabBarController properties in AppDelegate.h

@property (strongnonatomicIBOutlet UIWindow *window;

@property (strongnonatomicIBOutlet UITabBarController *tabController;

7. Go to your MainWindow.xib, Search for Tab Bar Controller from Objects Library and drag it to Placeholder/Objects Panel. Make the necessary connections from your AppDelegate Object outlets to your objects UIWindow and UITabBarController.

8. Right-click Window object in your Interface Builder, connect the \”rootViewController\” outlet to UITabBarController object.

9. Go to AppDelegate.m, under application:didFinishLaunchingWithOptions function, comment out all the codes inside that function, but leave these codes behind:

[self.window makeKeyAndVisible];

return YES;

10. Hit Run!

Let\’s set our two view controllers that we created a while a go, the First and Second View Controller.

11. Import the First and Second VC to your AppDelegate class.

12. Expand the Placeholders/Objects Panel, and the  TabController.

13. Select one of the two view controllers inside the Tab Controller, and change its class to \”FirstViewController.\”

Do the same thing with the other view controller, set its class to \”SecondViewController.\”

Hit Run and you\’re done! 


You may add an image or a tabTitle for every ViewController by following these steps:

Expand the Placeholder/Objects Panel, the TabBarController object, and the ViewControllers under it. Click the \”Tab Bar Item.\” Go to Attributes Inspector, the fourth button, next to \”Identity Inspector.\” Change the Title or the Image under the \”Bar Item\” Category.

For the images, you have to import those images to your project first. Right-click the folders on the Project Navigator, choose \”Add Files to project_name,\” choose the images you want to import.

#UITabbarController #tabbar #iPhone #InterfaceBuilder #IB #iOSTutorial #UITabbarControllerinIB #mobile #tabbarcontroller #iOS

8 views0 comments

Recent Posts

See All

Hi Everyone! It has been a very long while since I last posted in this blog. This time, I will be making a tutorial in using blocks when we are accessing our API or web services. Disclaimer: I am also

Post: Blog2 Post
bottom of page