Joel Derfner
Joel Derfner

Reputation: 2207

weird UITabBar color inconsistency in iOS7

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):

home screen feedback screen

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

webview screen

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.

settings screen

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.

Upvotes: 17

Views: 10763

Answers (2)

dianakarenms
dianakarenms

Reputation: 2695

You can also uncheck "Translucent" at the Attributes Inspector: enter image description here

Upvotes: 1

CSmith
CSmith

Reputation: 13458

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.

Upvotes: 24

Related Questions