I'm developing an iPhone application and I started out with the navigation based template. But now i'd like to add a Tap Bar controller at the bottom and I would like to do this without using Interface Builder. Can anybody tell me how to do this? Thanks in advance!
This is not supported by the framework.
A tab bar controller can only be created as follows:
In other words, a tab bar controller can't be pushed onto a navigation controller.
More info here:
http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/TabBarControllers/TabBarControllers.html#//apple_ref/doc/uid/TP40007457-CH102-SW1
If you are asking how to start with a navigation controller and then allow the user to navigate to a view with a tabbar, I do exactly this in my iPad app. Go to the website listed in my profile if you are interested to see how my app uses the tab bar.
Although, I used Interface Builder to accomplish it. In Interface Builder, I created sort of a master view that contains the tabbar control at the bottom and a "content" UIView above it. As the user tabs through views, the "content" view is programmatically assigned the view that the user is interested in.
I suppose you could also accomplish it without IB. Just use code this:
UITabBar *aTabBar = [UITabBar alloc] init];
[[self yourView] addSubview:aTabBar];
Of course, you will want to create tab bar items and assign view controllers to each item. You may also have to tweak the tab bar control's layout params so that it sits at the bottom of the view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With