简体   繁体   中英

how to change the color of the tabbar controller

Is there any way I can change the Tab Bar Controller's color to something other than the default black? I know this isn't possible in IB, but perhaps maybe through code?

在AppDelegate中

self.tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor grayColor];

In AppDelegate.m in didFinishLaunching... method write(this will change for whole app):

[[UITabBar appearance] setBarTintColor:[UIColor myColor]];

Or you can write in ViewController.m in method viewDidLoad:

[self.tabBarController.tabBar setBarTintColor: [UIColor mycolor]];

You can do with XIB/Storyboard as well as programmatically For Xib/storyboard select tab bar controller than tab and you can see all the options to change tab bar or tab bar view properties see the attached image Image attached here

For programmatically: for tab bar tint and background

[[UITabBar appearance] setTintColor:panelColor];
[[UITabBar appearance] setBarTintColor:[UIColor lightGrayColor]]; 

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM