I recently came back to native iOS development and am working on a Tab Bar app. I noticed the process of building one has changed. All the tutorials mention adding a Tab Bar controller to the mainwindow.xib of a Window-based application. I really do enjoy using the interface builder system to create a tab bar but this seems to be a thing of the past?
Without that initial window to add the tab bar controller it's kind of a mute point. The tab bar template isn't bad, it just uses code to setup each of the views tab bar elements, etc. This is fine, but I really did like the methodology of separating the interface and the code behind. When I work with clients it's nice to show them the interface changing visually.
My question is 1) Is it possible to still build a tab bar app using the tab bar controller and interface building to customize my tab bar? And 2) How do I go about doing this? Are there any tutorials? I'm not against building this up from scratch using the empty template.
Thanks,
David
Hello there i think this tutorial will help you:
in ios5 customization is quite simple:
vistit: http://kurrytran.blogspot.com/2011/10/ios-5-tutorial-creating-custom-tab-bar.html
it is all done with storyboards and then you set up everything in the viewdidload method.
- (void)viewDidLoad
{
UIImage *selectedImage0 = [UIImage imageNamed:@"HomeDB.png"];
UIImage *unselectedImage0 = [UIImage imageNamed:@"HomeLB.png"];
UIImage *selectedImage1 = [UIImage imageNamed:@"ScheduleDB.png"];
UIImage *unselectedImage1 = [UIImage imageNamed:@"ScheduleLB.png"];
UIImage *selectedImage2 = [UIImage imageNamed:@"BuildingsDB.png"];
UIImage *unselectedImage2 = [UIImage imageNamed:@"BuildingsLB.png"];
UIImage *selectedImage3 = [UIImage imageNamed:@"InformationDB.png"];
UIImage *unselectedImage3 = [UIImage imageNamed:@"InformationLB.png"];
UIImage *selectedImage4 = [UIImage imageNamed:@"MoreDB.png"];
UIImage *unselectedImage4 = [UIImage imageNamed:@"MoreLB.png"];
UITabBar *tabBar = self.tabBarController.tabBar;
UITabBarItem *item0 = [tabBar.items objectAtIndex:0];
UITabBarItem *item1 = [tabBar.items objectAtIndex:1];
UITabBarItem *item2 = [tabBar.items objectAtIndex:2];
UITabBarItem *item3 = [tabBar.items objectAtIndex:3];
UITabBarItem *item4 = [tabBar.items objectAtIndex:4];
[item0 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0];
[item1 setFinishedSelectedImage:selectedImage1 withFinishedUnselectedImage:unselectedImage1];
[item2 setFinishedSelectedImage:selectedImage2 withFinishedUnselectedImage:unselectedImage2];
[item3 setFinishedSelectedImage:selectedImage3 withFinishedUnselectedImage:unselectedImage3];
[item4 setFinishedSelectedImage:selectedImage4 withFinishedUnselectedImage:unselectedImage4];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
i hope it helps.