How can I change the tintColor of an unselected UITabBarItem title and background image iOS 8?
The default color for an unselected state is a light gray color, but it does not show on my darkish shade UITabBar background
I'd like my unselected state to have a color of [UIColor blackColor]
Inside my app delegate didfinishlaunchingwithoptions: I have
UIImage *deselectedE = [[UIImage imageNamed:@"mincraft_axe_green_32.png"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
UIImage *selectedE = [[UIImage imageNamed:@"mincraft_axe_green_32.png"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
e.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Profile" image:deselectedE selectedImage:selectedE];
[[UITabBar appearance] setTintColor:[UIColor blackColor]];
You can also set it up directly in Storyboard... Check my answer here: How to set UITabBarItem's unselected tint, ***including system items*** (iOS7)
Alternatively in
Assets
catalog, you can selectRender As
:Original Image
in the attributes of your image (View
>Utilities
>Show Attributes Inspector
or shortcut⌥⌘4
(Option + Command + 4))You can also render the image as original from the attributes inspector for the asset file without writing any code
In your AppDelegate.m inside of
application didFinishLaunchingWithOptions:
use the following code:Figured it out!
Use this to change the color of the text:
And make sure that image rendering mode is set to ORIGINAL for the images