Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove "More" tab in UITabBarController that has custom tab UI (not using tab bar)

I'm using a UITabBarController as a backing to present multiple view controllers, but I'm not using the default tab bar at the bottom for the user to tap on the tabs. Instead, I'm presenting a slide-out menu from the left that displays a list of tabs in a table view. So the user can tap on one of the cells in the table view and switch to that tab. This is a very common paradigm for displaying multiple view controller tabs without using the tab bar at the bottom of the UITabBarController.

Now that I've added more tabs, I'm having an issue with one of my tabs opening to UITabBarController's "More" controller. I don't need or want this "More" controller because I'm displaying my tabs in a scrollable list, not in a tab bar that has finite space.

How can I remove the "More" tab or tell my UITabBarController not to present the "More" screen? Is there some option to disable this?

like image 450
Ethan G Avatar asked Jan 23 '26 23:01

Ethan G


1 Answers

A workaround: Find the right timing for hiding more navigation bar. Add those code to your subclass of UITabBarController:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    if (self.viewControllers.count > 5)
    {
        self.moreNavigationController.delegate = self;
    }
}

in navigation delegate callback:

- (void)navigationController:(UINavigationController *)navigationController
  willShowViewController:(UIViewController *)viewController
                animated:(BOOL)animated

{
   navigationController.navigationBarHidden = YES;
}
like image 80
Hoogle Avatar answered Jan 26 '26 16:01

Hoogle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!