The Story
In the process of programming the Holler iPhone application, I took a look at a lot of the custom tab bar code currently available around the net but couldn’t find the solution I wanted. There were numerous attempts to customize the UITabBarController, none of which offered the simplicity that I was looking for. As such I wrote my own really simple tab bar.
I’ve decided to make the tab bar code available for anybody who’s trying to implement a crazy tab bar that your world-class designer has come up with! Implementing the custom tab bar can be implemented in one line code, after you’ve customized the included nib file (HBCustomTabBar.xib) and the tab bar manager (HBTabBarManager.m).
Just like many other libraries, all you need to do is include the tab bar manager in your view controller’s header file. Here’s an example view controller header file with the tab bar included:
@interface HollersViewController : UIViewController
@property (nonatomic, retain) HBTabBarManager *tabBar;
@end
In the implementation file of the view controller all you need to do is synthesize the tabBar property and then in the viewDidLoad method write the following line:
For the topView argument, you should include the top view that you want to display the tab bar above. The selectedIndex argument expects an integer of the bar button that is selected. It’s as simple as that! Feel free to let me know if you have any questions or feedback.
You can download the source code via the public Github project.