问题
I'm using iOS 7's tintColor
and barTintColor
properties to color my UITabBar
with this code in a subclass of UITabBarController:
[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:123/255.0 green:47/255.0 blue:85/255.0 alpha:1]];
[[UITabBar appearance] setTintColor:[UIColor colorWithRed:227/255.0 green:180/255.0 blue:204/255.0 alpha:1]];
On three screens, the color is what I want it to be (only two images illustrating this):


One one screen, the color is weirdly lighter. This screen is a UIWebView
.

Then on a fourth screen, the color is SUPER-light. This screen is the only one to use a storyboard--the rest are all done programmatically.

What am I doing wrong? Do the fact that the misbehaving screens are a UIWebView
and a storyboard have anything to do with why they're misbehaving? And how do I fix them? I've fiddled with the alpha of the bar but it doesn't change anything.
Thanks for your help.
回答1:
You're seeing tab bar translucency...i.e. the background view is bleeding through and being blurred. If you want to disable this, you can do:
[tabBar setTranslucent:NO]
on your tab-bar.
On your top two images, its not clear to me if the underlying view controller view is edge-to-edge, i.e. your top two images should look like the fourth one since both have pink backgrounds. Anyhow, setTranslucent:NO should make them all look like the top image.
回答2:
You can also uncheck "Translucent" at the Attributes Inspector:
来源:https://stackoverflow.com/questions/18905324/weird-uitabbar-color-inconsistency-in-ios7