I am a beginner in programming in iOS. I have a iOS application that has two classes(with xib), firstviewcontroller and secondviewcontroller. I want to add a tab bar to switch between these view controllers. if I for example add a tab bar to the first view, how to connect the views to the tab bar? Its just there, doing nothing..
0
votes
2 Answers
2
votes
Try Look into this url , this will help. http://www.amateurinmotion.com/articles/2009/01/24/creating-uitabbarcontroller-based-app-using-interfacebuilder.html
0
votes
This assumes that you want the tab bar as the main interface of your app.
In your app delegate, create a subclass of
UITabBarController
:UITabBarController *myTbc = [UITabBarController alloc] init];
Create instances of your two view controllers and add them to an
NSArray
NSArray *tabsArray = @[firstVC, secondVC];
Set that NSArray as the
viewControllers
property of the tab bar controller[myTbc setViewControllers:tabsArray];
Set the tab bar controller as the app's root view:
self.window.rootViewController = theTbc;