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

  • Home
  • SEARCH
  • 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 7885063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:57:53+00:00 2026-06-03T04:57:53+00:00

I have implemented a custom UITabBar solution for a project. Essentially, if there are

  • 0

I have implemented a custom UITabBar solution for a project. Essentially, if there are more than 5 items, I use a scrollView that will allow the user to scroll through the additional tab items and suppresses the more button. A similar look and feel can be seen in the Weather Channel app.

Each tab bar item corresponds to a UINavigationController that manages the stack of views for each tab. The issue I’m having is when I have more than 5 tab items, from tab 5 onward does not correctly maintain the navigation stack. It seems that the moreNavigationController kills the navigation stack each time you return to that tab and you are brought to the initial page again.

I’ve overridden the setSelectedViewController method as follows:

- (void) setSelectedViewController:(UIViewController *)selectedViewController {
    [super setSelectedViewController:selectedViewController];
    if ([self.moreNavigationController.viewControllers count] > 1) {
        self.moreNavigationController.viewControllers = [[NSArray alloc] initWithObjects:self.moreNavigationController.visibleViewController, nil];
    }
}

This code will remove the More functionality on the left nav button but it doesn’t solve the issue of maintaining the navigation stack. All other tabs work fine. I can traverse down several views and the stack is maintained after I leave and return to that tab. I understand that this is a complicated issue so please let me know if there are areas where I can provide clarity. Thanks!

  • 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-03T04:57:54+00:00Added an answer on June 3, 2026 at 4:57 am

    This is how I ended up fixing this:

    - (void) setSelectedViewController:(UIViewController *) selectedViewController {
        self.viewControllers = [NSArray arrayWithObject:selectedViewController];
        [super setSelectedViewController:selectedViewController];
    }
    

    Basically any tab from 5 on gets its navigation controller replaced by the moreNavigationController when you intiially set the viewControllers on UITabBarController. Therefore, I dynamically set viewControllers to just contain the tab I’m clicking. There never ends up being more than 1 in this case so the moreNavigationController doesn’t come into play.

    When I init my custom controller, I just supply the first tab as the viewControllers so the application can load.

    - (id) init {
        self = [super init];
        if (self) {
            self.delegate = self;
            [self populateTabs];
        }
        return self;
    }
    
    - (void) populateTabs {
        NSArray *viewControllers = [self.manager createViewsForApplication];
        self.viewControllers = [NSArray arrayWithObject:[viewControllers objectAtIndex:0]];
        self.tabBar.hidden = YES;
        MyScrollingTabBar *tabBar = [[MyScrollingTabBar alloc] initWithViews:viewControllers];
        tabBar.delegate = self;
        [self.view addSubview:tabBar];
    }
    

    For clarity, the tabBar delegate is set to this class so that it can respond to tab clicks. The delegate method is as follows:

    - (void) tabBar:(id) bar clickedTab:(MyScrollingTabBarItem *) tab {
        if (self.selectedViewController == tab.associatedViewController) {
            [(UINavigationController *) tab.associatedViewController popToRootViewControllerAnimated:YES];
        } else {
            self.selectedViewController = tab.associatedViewController; 
        }
        // keep nav label consistent for tab
        self.navigationController.title = tab.label.text;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented custom validation for my JSP forms and when there are errors
I have implemented a custom IPrincipal that I set in protected void Application_PostAuthenticateRequest(Object sender,
I have implemented a custom CellRenderer in PyGTK that can take longer to render
I have implemented a custom QAbstractListModel that is displayed in an editable QListView .
I have a listview, with around 200 items, I have implemented a custom ArrayAdapter
We have implemented some custom tooltip-drawing code that fires on Tick events of a
I have implemented a custom dialog for my application. I want to implement that
My problem is that I have implemented a custom arrayadapter, that fetches images from
Alright. I have implemented a custom JTable model that includes the whole @Override public
I have a spring-ws (2.0.2) service I have implemented that requires some custom elements

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.