Home > CodeSnippets, iOS > UINavigationBar Color of More Tab

UINavigationBar Color of More Tab

A “More” tab will automatically created when adding more than 5 view controllers to a UITabBarController. The tab includes a view controller and even a modal view for letting the user edit the app’s tabs in the order they want.

The moreNavigationController and the modal view (edit) are colored with the Default blue. Change the color of the moreNavigationController:

tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor orangeColor];

You can also use the barStyle property if you like:

tabBarController.moreNavigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;

Change the color of the Navigation bar for the modal view of “Edit”:

First, if you haven’t already, make sure your AppDelegate implements the UITabBarControllerDelegate. Then add the optional delegate method willBeginCustomizingViewControllers: in your AppDelegate’s implementation file, and add the following lines of code:

– (void)tabBarController:(UITabBarController *)controller willBeginCustomizingViewControllers:(NSArray *)viewControllers {
UIView *editView = [controller.view.subviews objectAtIndex:1];
editView.backgroundColor = [UIColor grayColor];
UINavigationBar *modalNavBar = [editView.subviews objectAtIndex:0];
modalNavBar.tintColor = [UIColor orangeColor];
modalNavBar.topItem.title = @”Edit Tabs”;
}

Again, it’s possible to set the barStyle property instead of the tintColor, but barStyle won’t give you all the colour options, of course.

Advertisements
Categories: CodeSnippets, iOS
  1. October 6, 2010 at 05:14

    Thank you very much! I was really struggling to find a way to change the colors of the “More” navigation controller to match the rest of my app. The one line of code you suggested in the right place in my app did the trick.

    • June 15, 2012 at 04:03

      Hi, I have the same problem, where do you put this code:
      (tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor orangeColor];) in what file? Thanks, Brian

      • June 15, 2012 at 08:39

        Hi, I did it in my main AppDelegate file which implements the UIApplicationDelegate protocol.

        @interface AppDelegate : NSObject {
        UIWindow *window;
        UITabBarController *tabBarController;

        }
        @property (nonatomic, retain) UIWindow *window;
        @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;

        @implementation AppDelegate

        – (void) applicationDidFinishLaunching:(UIApplication *)application {

        UINavigationController *moreController = self.tabBarController.moreNavigationController;
        //moreController.navigationBar.barStyle = UIBarStyleBlackOpaque;
        moreController.navigationBar.tintColor = [UIColor orangeColor];
        moreController.navigationBar.hidden = NO;

  2. June 15, 2012 at 04:13

    Hi, could you give me a step by step process of this, where the code is placed and what file is needed to implement an alternative color of the UINavigationBar. Thanks, Brian

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: