Color of UIToolbar not changing

Ali picture Ali · Apr 7, 2011 · Viewed 10.5k times · Source

I have created a UIToolbar. I am trying to give it black color using:

toolbar.barStyle = UIBarStyleBlackOpaque;

or

toolbar's background property. But its color does not change in either case.

How can I change it?

Answer

Ashish picture Ashish · Jan 13, 2014

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...