I have 7 tabs in my UITabBar
. iOS
automatically groups the last 2 tabs into a tab called 'More'. I have set the navigation bar tint color for the 7 tabs in viewDidLoad
as follows:
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
How do I set the color of the navigation bar for the automatically generated 'More' tab?
You can access self.tabBarController.moreNavigationController
to get the navigation controller that appears when the More tab bar item is tapped by the user. Now you can perform modifications and customizations. For example you can change the style of its navigation bar. Example:
UINavigationController* more = self.tabBarController.moreNavigationController;
more.navigationBar.barStyle = UIBarStyleBlack;
For more about how to customize what appears when the More tab bar item is tapped, see this section of my book:
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
This line changes the tintColor
for navigation bar.
From your question, It seems to me (and others, of course) that you have misunderstood UITabBarController
as UINavigationController
.
You can find all the information about customizing UITabBarController
here
You need to change the color of UINavigationController in AppDelegate.m
UIColor *navBarColor = [UIColor blackColor];
[[UINavigationBar appearance] setTintColor:navBarColor];
self.navigationController.navigationBar.tintColor = navBarColor;
Try apperance (probably in didfinishlaunchingwithoptions in the app delegate).
[[UITabBar appearance] setTintColor:[UIColor blackColor]];
[[UITabBarItem appearance] setTintColor:[UIColor blackColor]];
For iOS 7 You can change the colour of the navigation bar, set to non-translucent (yes by default) and change the colour of the navigation title by adding the following into the AppDelegate:
UINavigationController *moreController = _tabBarController.moreNavigationController;
moreController.navigationBar.barTintColor = [UIColor orangeColor];
moreController.navigationBar.translucent = NO;
moreController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
对于ios 8.0
self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.