I have found a tab bar library that I would like to use, but need to use storyboards for my application.
Upon seeing that this library works with xibs, I took it upon myself to adapt it to work with my storyboard app. However, I could not make it work.
The library can be found here : http://www.cocoacontrols.com/controls/tbtabbar
So how can I adapt the library to make it work with storyboards, and if that cannot be done, how can I use a uinavigationcontroller inside of the mainwindow, as I can’t get that to work as well.
Thanks
EDIT: This is the code that swaps view controllers:
-(void)switchViewController:(UIViewController *)viewController {
UIView *currentView = [self.view viewWithTag:SELECTED_VIEW_CONTROLLER_TAG];
[currentView removeFromSuperview];
viewController.view.frame = CGRectMake(0,0,self.view.bounds.size.width, self.view.bounds.size.height-(tabBar.frame.size.height));
viewController.view.tag = SELECTED_VIEW_CONTROLLER_TAG;
[self.view insertSubview:viewController.view belowSubview:tabBar];
}
I completely reworked my answer and created a sample project to help make sure I didn’t miss anything the second time around.
You should be able make all of your view controllers (with identifiers) in the storyboard subclasses of TBViewController. This can be done by clicking on your UIViewController, going to the identity inspector (cmd alt 3) and then typing in “TBViewController”. It should autocomplete if everything is working correctly. The next step is to create the tabs for your tab controller. Each tab needs 3 values before it can be added to the TBTabBar controller.
Below is a custom method I have created to help instantiate these TBTabButton objects which accept all three requirements as paramaters:
The View controllers can be retrieved from storyboard by using the method in the next code block.
Now you have a method which will create for you ‘ready-to-add’ TBTabButton objects. Use this method to create each desired button for your tab bar. Once you have these instantiated, you must add them to an NSArray so that it may be passed as a paramater for the creation of the TBTabBar object. All that is left is to add the UITabBar object to the view and set it to display based on defaults.
This method must be called in your -(void)viewDidLoad method;
Only other things that need to be done are:
Hopefully this addresses any issues were you having. This seemed to be the one thing that might be a little confusing. As long as you are following the other steps in the README correctly, I believe this should work just dandy for you.
If that doesn’t work, let me know and I can try to post a link to the working example I made for the code above.