Search code examples
iphoneobjective-cuitoolbartint

Color of UIToolbar not changing


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?


Solution

  • Have you tried setting the tint property on UIToolbar? ie:

    - (void)viewDidLoad {
      [super viewDidLoad];
      UIToolbar *toolbar=[[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 46)];
      toolbar.tintColor=[UIColor redColor];
      [self.view addSubview:toolbar];
      [toolbar release];
    }
    

    Detailed in the apple docs