Question

I am trying to change the tint color of the UITabBarItem when it is selected with this line of code:

[[UITabBar appearance]setTintColor:[UIColor colorWithRed:89 green:216 blue:239 alpha:1]];

However when I select the TabBar the tint color becomes white.

Anyone know why?

Thank you!

Was it helpful?

Solution

In uicolor:RGB, you need to devide the value of 255.

[UIColor colorWithRed:89/255.0f green:216/255.0f blue:239/255.0f alpha:1]

OTHER TIPS

Try the below:

[[UITabBar appearance] setTintColor:[[UIColor colorWithRed:89/255.0f green:216/255.0f blue:239/255.0f alpha:1]];

[[UITabBar appearance] setBarTintColor:[UIColor yellowColor]];//set rgb value if you want 

set the selectedImageTintColor property to your color.

Try this In your app delegate's didFinishLaunching method:

[[UITabBar appearance] setSelectedImageTintColor:[UIColor colorWithRed:89/255.0f green:216/255.0f blue:239/255.0f alpha:1]];

In iOS 7 use:

[[UITabBar appearance] setTintColor:[UIColor colorWithRed:89/255.0f green:216/255.0f blue:239/255.0f alpha:1]];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top