Hi
I have build a UITabBarController programmatically and populated its viewControllers
property.
When I run this the tabBar buttons are, of course, empty, I tried to access the tabBar
property on the UITabBarController to set its items
property to my text/images, which made the app crash.
Going through the documentation for the UITabBarController I read this under the tabBar property:
The tab bar view associated with this controller. (read-only)
@property(nonatomic,readonly) UITabBar *tabBar Discussion You should never attempt to manipulate the UITabBar object itself stored in this property. If you attempt to do so, the tab bar view throws an exception. To configure the items for your tab bar interface, you should instead assign one or more custom view controllers to the viewControllers property. The tab bar collects the needed tab bar items from the view controllers you specify.
The tab bar view provided by this property is only for situations where you want to display an action sheet using the showFromTabBar: method of the UIActionSheet class.
This is what I want:
The tab bar collects the needed tab bar items from the view controllers you specify.
It also makes perfect sense that you do not setup up the tabBar in one place and the content in another.
But how do I define these items in my viewControllers which are all of type UINavigationController, with my custom ViewController as the rootController?
Is there some protocol besides the UITabBarControllerDelegate I need to implement?
Hope someone could point me in the right direction, I did not see this one coming:) Thanks