NikLanf
NikLanf

Reputation: 1663

faded, pale background color in UITabBar.background

guys, I am trying to customize UITabBar, but problem is that when I set up simple green background color in UITabBar.background, result is insufficient. Like something lies on background. Here it is look like: faded color

UITabBarController is created in storyboard, but background color I set up in code. Here is appDelegate:

TabBarController* bc=(TabBarController*)self.window.rootViewController;
bc.tabBar.backgroundColor=[UIColor greenColor];

If I set up pictures on background and on items - they just almost invisible. I've tried playing with tint colors on the right bar in storyboard, but all was useless.

Upvotes: 4

Views: 4626

Answers (3)

Phil
Phil

Reputation: 1577

You need to set the transparency of the tabBar:

Swift :

self.tabBar.translucent = false

Objective C :

[[self tabBar] setTranslucent:NO]

Upvotes: 2

DS.
DS.

Reputation: 3004

The same in Swift, iOS 9.

self.tabBarController?.tabBar.barTintColor = UIColor(red: 254/255.0, green: 200/255.0, blue: 93/255.0, alpha: 1.00)

Upvotes: 1

Storm Factory
Storm Factory

Reputation: 388

I had a similar issue when programmatically creating the UITabBarController background color in iOS 8. The problem was I was using backgroundColor when I should have been be using barTintColor. Try this.

TabBarController* bc=(TabBarController*)self.window.rootViewController;
bc.tabBar.barTintColor=[UIColor greenColor];

Let me know if that works for you.

Upvotes: 12

Related Questions