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 7739739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:35:49+00:00 2026-06-01T08:35:49+00:00

I have an app with a custom UITabBarController that contains five view controllers. Within

  • 0

I have an app with a custom UITabBarController that contains five view controllers. Within each of these view controllers, other view controllers can be accessed. Ideally, I would like my custom UITabBarController to appear in each ViewController-regardless on whether or not the view controller originates directly from the tabbar.

I think this can be accomplished using a Navigation Controller within each of the original five view controllers, however, is there a way to just add the custom UITabBarController to each view controller? I tried doing this by the following ways in my viewDidLoad methods:

AppDelegate *appDelegate = [(AppDelegate *)[UIApplication sharedApplication] delegate];
tabbarController = appDelegate.tabBarController;

tabbarController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:tabbarController.view];

but I get a bad_access in my app delegate when I run the code.

Any thoughts?

  • 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-01T08:35:51+00:00Added an answer on June 1, 2026 at 8:35 am

    As you correctly stated, using ‘UINavigationController’s as root controllers of each tab will achieve what you are trying to do.

    Here is an example of how to easily setup your tabbar with navigation controllers:

    - (void)setupTabBar {
    
        // Create nav-controller for local use
        UINavigationController *localNavController;
    
        // New tabbar controller and array to contain the view controllers
        UITabBarController * theTabBarController = [[UITabBarController alloc] init];
    
        NSMutableArray *localViewControllersArray = [[NSMutableArray alloc] initWithCapacity:4];
    
    
        /*--------------------------------------------------------------------
         * Setup the view controllers for the different tabs
         *-------------------------------------------------------------------*/
    
        // Root view controller for Tab 1
        UIViewController *vc;
    
        vc = [[ViewController1 alloc] initWithNibName:@"ViewController1" bundle:nil];
        localNavController = [[UINavigationController alloc] initWithRootViewController:vc];
        localNavController.tabBarItem.image = [UIImage imageNamed:@"image.png"];
        localNavController.tabBarItem.title = @"Tab1";
    
        // Add navigation controller to the local vc array (1 of 4)
        [localViewControllersArray addObject:localNavController];
    
    
        // Root view controller for Tab 2
        vc = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];
        localNavController = [[UINavigationController alloc] initWithRootViewController:vc];
        localNavController.tabBarItem.image = [UIImage imageNamed:@"image.png"];
        localNavController.tabBarItem.title = @"Tab2";
    
        // Add navigation controller to the local vc array (2 of 4)
        [localViewControllersArray addObject:localNavController];
    
    
        // Root view controller for Tab 3
        vc = [[ViewController3 alloc] initWithNibName:@"ViewController3" bundle:nil];
        localNavController = [[UINavigationController alloc] initWithRootViewController:vc];
        localNavController.tabBarItem.image = [UIImage imageNamed:@"image.png"];
        localNavController.tabBarItem.title = @"Tab3";
    
        // Add navigation controller to the local vc array (3 of 4)
        [localViewControllersArray addObject:localNavController];
    
    
        // Root view controller for Tab 4
        vc = [[ViewController4 alloc] initWithNibName:@"ViewController4" bundle:nil];
        localNavController = [[UINavigationController alloc] initWithRootViewController:vc];
        localNavController.tabBarItem.image = [UIImage imageNamed:@"image.png"];
        localNavController.tabBarItem.title = @"Tab4";
    
        // Add navigation controller to the local vc array (4 of 4)
        [localViewControllersArray addObject:localNavController];
    
    
        // Point the tab bar controllers view controller array to the array
        // of view controllers we just populated
        theTabBarController.viewControllers = localViewControllersArray;
    
        self.tabBarController = theTabBarController;
    
        [self.window setRootViewController:self.tabBarController];
    
        ...
    }
    

    Hope this helps 🙂

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

Sidebar

Related Questions

I have an app written in XUL which contains a custom tree view that
I have an app that contains a custom view, and in it I want
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have a custom view in my Android App that uses a ScaleGestureDetector.SimpleOnScaleGestureListener to
I have an app that has a UINavigationController that pushes a UITabBarController into view.
I have an app that uses various view controllers as tabs. I'm in the
I have a web app where people can create custom content on the web
I have a wpf app that needs to communicate(exchange data) with a custom designed
In my app I have need to trigger show some custom view when status
I have an app that starts with a custom uri E2L:// . In a

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.