I'm trying to set the background color of a UIToolBar
. I tried selecting the color from IB's Attribute Inspector, and tried setting it programmatically through setBackgroundColor:[UIColor ...]
.
Both solutions work, but only partially: the color blends something like 50% with white and the toolbar is very light...doesn't show the color I actually chose, but a much lighter version of it.
How can I have the UIToolBar
of the actual color I'm choosing? It's probably very simple to solve, but I can't find a way and can't find answers online either.
Write below code in your viewDidLoad
self.navigationController.toolbar.barTintColor = [UIColor redColor];
It will set red color as your tool bar background.
Reference link
https://web.archive.org/web/20160321155823/https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/Bars.html#//apple_ref/doc/uid/TP40013174-CH8-SW5
In it they said that Use barTintColor to tint the bar background
.
IN iOS 7 you need to set the barTintColor Property-
UIToolbar *doneToolbar=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 584, 320, 44)]; doneToolbar.translucent=NO; doneToolbar.barTintColor=[UIColor redColor]; [self.view addSubview:doneToolbar];
I have used it its working fine...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With