UIToolbar tintColor and barTintColor

I have a code like this:

UIView *colorView = [[UIView alloc] init]; colorView.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, 64.0); colorView.backgroundColor = [UIColor blackColor]; //colorView.tintColor = [UIColor blackColor]; UIToolbar *toolbar = [[UIToolbar alloc] init]; toolbar.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, 44.0); self.view addSubview:colorView]; [self.view addSubview:toolbar]; 

Why does the toolbar subconstructor have a different color than my opinion? The view looks black, and the toolbar is light gray? Is there a blur or something?

+7
ios ios7 uiview uitoolbar tintcolor
source share
2 answers

The behavior from some UINavigationBar properties has changed since iOS 7 . I have already explained this in my Answer .

Take a look at the Bar style for iOS 6 and iOS 7 :

enter image description here


Here you can note two points:

  • You can change the Bar style to translucent dark instead of translucent light (default).
  • You can change the translucent property to NO from YES (default).
+7
source share

Try this code, it will help you,

 UIToolbar *toolbar = [[UIToolbar alloc] init]; toolbar.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, 44.0); toolbar.barStyle = UIBarStyleBlackTranslucent; toolbar.tintColor = [UIColor blackColor]; toolbar.alpha = 0.0; 

Change tintColor and alpha based on your requirements.

+2
source share

All Articles