I am trying to change icon color of tab bar item of my custom tab bar,
But setSelectedImageTintColor
and setTintColor
are not working together.
if that code order is
[[UITabBar appearance] setSelectedImageTintColor:[UIColor greenColor]];
[[UITabBar appearance] setTintColor:[UIColor redColor]];
then output is
and if that code order is
[[UITabBar appearance] setTintColor:[UIColor redColor]];
[[UITabBar appearance] setSelectedImageTintColor:[UIColor greenColor]];
then output is
I have used following code inside didFinishLaunchingWithOptions
method, first two lines are working fine and the problem is in last two line
//To set color for unselected tab bar item's title color
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor redColor], NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
//To set color for selected tab bar item's title color
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor greenColor], NSForegroundColorAttributeName,nil] forState:UIControlStateSelected];
//To set color for unselected icons
[[UITabBar appearance] setTintColor:[UIColor redColor]];
//To set color for selected icons
[[UITabBar appearance] setSelectedImageTintColor:[UIColor greenColor]];
Note - I have separate custom tabbar class but I am not changing icon color in custom tabbar class
Thanks in anticipation.