iOS 7.1.1
If someone is going to need to use globally setting tint color:
[[UIView appearance] setTintColor:[UIColor whiteColor]];
In didFinishLaunchingWithOptions
of AppDelegate
.
Also below code will change only tab bar tint color in any viewDidLoad
method:
[self.tabBarController.tabBar setTintColor:[UIColor redColor]];
What finally worked for me was:
[self.tabBar setTintColor:[UIColor redColor]];
[self.tabBar setBarTintColor:[UIColor yellowColor]];
There is an much easier way to do this.
Just open the file inspector and select a "global tint".
You can also set an app’s tint color in Interface Builder. The Global Tint menu in the Interface Builder Document section of the File inspector lets you open the Colors window or choose a specific color.
Also see:
You can set your tint color and font as setTitleTextattribute:
UIFont *font= (kUIScreenHeight>KipadHeight)?[UIFont boldSystemFontOfSize:32.0f]:[UIFont boldSystemFontOfSize:16.0f];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName,
tintColorLight, NSForegroundColorAttributeName, nil];
[[UINavigationBar appearance] setTitleTextAttributes:attributes];
Write this in your View Controller class of your Tab Bar:
// Generate a black tab bar
self.tabBarController.tabBar.barTintColor = [UIColor blackColor];
// Set the selected icons and text tint color
self.tabBarController.tabBar.tintColor = [UIColor orangeColor];
In "Attributes Inspector" of your Tab Bar Controller within Interface Builder make sure your Bottom Bar is set to Opaque Tab Bar:
Now goto your AppDelegate.m file. Find:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
And then add this code between the curly braces to change the colors of both the tab bar buttons and the tab bar background:
///----------------SET TAB BAR COLOR------------------------//
//--------------FOR TAB BAR BUTTON COLOR---------------//
[[UITabBar appearance] setTintColor:[UIColor greenColor]];
//-------------FOR TAB BAR BACKGROUND COLOR------------//
[[UITabBar appearance] setBarTintColor:[UIColor whiteColor]];
After trying out all the suggested solutions, I couldn't find any very helpful.
I finally tried the following:
[self.tabBar setTintColor:[UIColor orangeColor]];
which worked out perfectly.
I only provided one image for every TabBarItem. Didn't even need a selectedImage.
I even used it inside the Child-ViewControllers to set different TintColors:
UIColor *theColorYouWish = ...;
if ([[self.parentViewController class] isSubclassOfClass:[UITabBarController class]]){
UITabBarController *tbc = (UITabBarController *) self.parentViewController;
[tbc.tabBar setTintColor:theColorYouWish];
}
In app delegate didFinishLaunchingWithOptions:
window.tintColor = [UIColor purpleColor];
sets the tint color globally for the app.
Source: Stackoverflow.com