Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8452207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:26:32+00:00 2026-06-10T11:26:32+00:00

I have found a tab bar library that I would like to use, but

  • 0

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];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:26:33+00:00Added an answer on June 10, 2026 at 11:26 am

    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.

    1. Normal Image
    2. Highlighted Image
    3. View controller associated with the button

    Below is a custom method I have created to help instantiate these TBTabButton objects which accept all three requirements as paramaters:

    -(TBTabButton*)TBTabButtonWithStoryBoardID:(NSString*)identifier andButtonImageNamed:(NSString*)normalImageTitle andHighlightedImageNamed:(NSString*)highlightImageTitle{
    
         //Create the tab bar and assign normal image
         TBTabButton *tabBarButtonItem = [[TBTabButton alloc] initWithIcon:[UIImage imageNamed:normalImageTitle]];
    
         //Assign Highlighted image
         tabBarButtonItem.highlightedIcon = [UIImage imageNamed:highlightImageTitle];
    
         //Fetch the subclassed view controller from storyboard and assign as viewController
         tabBarButtonItem.viewController = [self TBViewControllerFromStoryboardWithIdentifier:identifier];
    
         return tabBarButtonItem;
    }
    

    The View controllers can be retrieved from storyboard by using the method in the next code block.

    -(TBViewController*)TBViewControllerFromStoryboardWithIdentifier:(NSString*)identifier{
    
        //instantiateViewControllerWithIdentifier returns a UIViewController Object
        UIViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];
    
        //check if UIViewController is a subclassed TBViewController
        if([viewController isKindOfClass:[TBViewController class]]){
    
            //if it is then send it back as the correct type
            return (TBViewController*)viewController;
        }
        return nil;
    }
    

    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.

    -(void)setTBTabBar{
    
        //Instantiate your tab TBTabButtons
    
        TBTabButton *tab1 = [self TBTabButtonWithStoryBoardID:@"tab1"
                                  andButtonImageNamed:@"favoritesIcon.png"
                                   andHighlightedImageNamed:@"favoritesIconHighlighted.png"];
    
        TBTabButton *tab2 = [self TBTabButtonWithStoryBoardID:@"tab2"
                                  andButtonImageNamed:@"mentionsIcon.png"
                                  andHighlightedImageNamed:@"mentionsIconHighlighted.png"];
    
        TBTabButton *tab3 = [self TBTabButtonWithStoryBoardID:@"tab3"
                                  andButtonImageNamed:@"messagesIcon.png"
                                  andHighlightedImageNamed:@"messagesIconHighlighted.png"];
    
    
        //Add them to an array
        NSArray *arrayOfTBViewControllers = [NSArray arrayWithObjects: tab1, tab2, tab3, nil];
    
        //Instantiate your TBTabBar object with your array of TabButtons. Set this view as delegate
        tabBar = [[TBTabBar alloc] initWithItems:arrayOfTBViewControllers];
        tabBar.delegate = self;
    
        //Add it to the view and set it to show defaults
        [self.view addSubview:tabBar];
        [tabBar showDefaults];
    }
    

    This method must be called in your -(void)viewDidLoad method;

    Only other things that need to be done are:

    1. define SELECTED_VIEW_CONTROLLER_TAG 98456345 in your _prefix.pch file
    2. Turn off ARC for the imported files by adding ‘-fno-objc-arc’ flag under compiled sources

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found already some similar discussion on this, but would like to investigate
I have an app using a tab bar host api that I found and
I have a iPad app using XCode4 with Storyboards, that has a Tab Bar
I have found that I have no problem using require to load something like
I have an app that has a tab bar & nav bar for normal
I trying to use tabbar badges but i have problem ... I have found
I would like to extend the tab control to have closeable tab items. I
Sorry but I found no clear answer on that. I have an iphone app
I have found that call stack helps in finding the line number of a
I have found that it is impossible to write ( file_put_contents or simple fwrite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.