Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIToolbar tintColor and barTintColor issues

I have code like so:

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 subview have a different color then my view? The view appears black and the toolbar appears light gray? Is there a blur or something causing this?

like image 832
cdub Avatar asked Oct 22 '13 07:10

cdub


People also ask

How do I change the color of the navigation bar in Swift?

navigationBar. barTintColor = UIColor. newBlueColor() and of course this just changes the colour of the navigation bar of the view controller that the code is within.

How do I change the navigation bar on my Iphone?

Change the Bar Style A user changes the navigation bar's style, or UIBarStyle , by tapping the “Style” button to the left of the main page. This button opens an action sheet where users can change the background's appearance to default, black-opaque, or black- translucent.

How do you make the navigation bar transparent in Swift iOS?

You need to do three things to make a navigation bar transparent. Set background image to non-nil empty image ( UIImage() ). Set shadow image to non-nil empty image ( UIImage() ). Set isTranslucent to true .


1 Answers

Behavior from some of the properties of UINavigationBar has changed from iOS 7. I have already explained this thing in my Answer.

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

enter image description here


You can note two points here :

  1. You can change the Bar style to translucent dark instead of translucent light (default).
  2. You can change the translucent property to NO from YES (default).
like image 110
Bhavin Avatar answered Sep 19 '22 07:09

Bhavin