문제

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!

도움이 되었습니까?

해결책

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]

다른 팁

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]];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top