UINavigationBar background color not the exact UIColor I set it to

change navigation bar color swift
ios 13 navigation bar color
set navigation bar title swift
uinavigationcontroller background color
change navigation bar title color swift
set navigation bar color programmatically
swiftui navigation bar color
change back button color swift

Please look at the screenshot below.

I set all the tint colors from the same UIColor object for the UINavigationBar, search bar and toolbar at the bottom. But for some reason the navigationbar color is slightly different. What could be the reason for this?

Thanks..


The difference between your navigation bar and search bar is because the navigation bar is translucent,the system will apply a default alpha value for the navigation bar.

Try self.navigationController.navigationBar.translucent = NO;

Setting iOS Navigation background color not working correctly, Nothing I do seems to make it 100% accurate. So I changed the code navigationBar.barTintColor = UIColor.black Also in a blank project, fresh, same issue. different navigation bar background color between iOS 10 & iOS 11. I'm setting my  UINavigationBar *bar = [self.navigationController navigationBar]; UIColor* aqua = [UIColor colorWithRed:0 green:1 blue:1 alpha:1]; [bar setTintColor:aqua]; Wont even compile This is not a designers q&a. If your only problem is that you can't create aqua color using RGB, you should go to Photoshop and experiment.


UINavigationBar has a bit of a strange behavior when it comes to the color you set on it. As other members have pointed out, you do have to set the translucent boolean to false, but this isn't all to get your bar to match the color you are trying to set. It will be close, but if you look carefully it will not be the exact color you are trying to use. In order to set the true color on UINavigationBar you need to understand what it is doing.

Let's say that I wanted to set my UINavigationBar to this cool color green.

That would be an RGB value of: R=90 | G=200 | B=95.

What UINavigationBar will do is apply it's built-in styling by giving this green a "glossy" look. The result for us is that it is taking our green RGB values and upping each by a factor of 20.

If you look close the green square above does not exactly match the one UINavigationBar is displaying with the same RGB values. This looks just slightly brighter.

To fix this, simply reduce the RBG values by 20 for the color you intend to use for the UINavigationBar's in your application.

So R=90 | G=200 | B=95 will become R=70 | G=180 | B=75.

UINavigationBar background color not the exact UIColor that is set it to, After discussion, we find that #CeccoCQ used another setting for UIView. That makes every view have a custom background color (in the image, it's gray color). Returns the background image to use for a given bar position and set of metrics. func set Background Image (UIImage?, for : UIBar Position, bar Metrics : UIBar Metrics) Sets the background image to use for a given bar position and set of metrics.


You will have to disable property translucent for navigation bar

you can do it programatically with following line

self.navigationController?.navigationBar.isTranslucent = false 

OR

Just un-tick "Translucent" check box from storyboard, you will find it in UINavigationBar properties on UINavigationController

Color differences between UINavigationBar background and UIView , When I set the barTintColor color for a UINavigationBar to be, say, [UIColor transparency of the UINavigationBar, but I still get different colors even when I set​  To set the background color for a navigation bar we can either do it programmatically or through the storyboard if it is on storyboard. Method 1 Let's see how to change the background color of a navigation bar through the storyboard editor.


It differs because of default UINavigationBar blur effect. I can suggest to set 2px width stretchable background image with your color. Something like this:

    UIImage *image = [UIImage imageNamed:@"yourBlueImage"];
    image = [image stretchableImageWithLeftCapWidth:image.size.width / 2.0f topCapHeight:0.0f];
    [yourNavBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];

It's like a trick, because when you set custom backgroundImage blur effect will be disabled and you'll get exact color.

Customize navigation bar appearance with swift (Example), This code not affect to the color of navigation bar title. barTintColor = uicolorFromHex(0x034517) // change navigation item title color In order to change title of the navigation item(in ViewController) you have to set the title  UINavigationBar has a bit of a strange behavior when it comes to the color you set on it. As other members have pointed out, you do have to set the translucent boolean to false, but this isn't all to get your bar to match the color you are trying to set. It will be close, but if you look carefully it will not be the exact color you are trying to use.


navigationBar.barStyle = UIBarStyle.blackOpaque

Worked to prevent undesired blending with the background, when none of the previous answers worked (in iOS 9.3).

How to set background for Navigation Bar in iOS?, To set the background color for a navigation bar we can either do it programmatically or through the storyboard if it is on storyboard.Method  UINavigation Bar enables you to display your app’s navigational controls in a bar along the top of the iOS device’s screen. You can use it to design a distinctive navigation bar that matches your app’s design and creates intuitive interaction for your users.


[Bug] Xamarin.Forms 4.5 ignores iOS status bar colour change , Updating from 4.4 to 4.5 iOS status bar colour is now getting ignored. is this PR - #8791 In my project I set the Status bar background colour, style ios navbar UIColor barTintColor = UIColor. BarTintColor = barTintColor; UINavigationBar. [iOS] Fixed issues related with NavigationBar colors #9836. UINavigationBar. appearance (). scrollEdgeAppearance = coloredAppearance. Note that bar color that set with backgroundColor in iOS13 will result in true color, just like when you set barTintColor with isTranslucent = false. I still can't figure out how to make it be a translucent color, luckily that I always hate that translucent color.


Navigation bar color is wrong |Apple Developer Forums, I want to set the background color of my navigation bar to. [[UINavigationBar appearance] setBarTintColor:[UIColor Not being able to rely on colors having the same color feels like not their graphic artists after they insist that they put in the exact color the artist asked for but the color comes out wrong. This issue occurs whether I am using a system color or if I am using a custom color with different shades for light and dark mode. Like edorphy stated as well, if I change the view the navigation bar color will update to the correct color scheme but it will not update if I leave it on the same view and change between the two appearance modes.


When Your iOS Colors Don't Match in Storyboards vs Code, The exact change was that, as of iOS 10 SDK, the UIColor comes when your interface builder color picker is NOT setting colors according to this color space. Imagine that you have a screen in your app that contains a UINavigationBar and  In here tintColor attribute change the background color of the navigation bar. barTintColor attribute affect to the color of the. back indicator image. button titles. button images. This code not affect to the color of navigation bar title.