Different color shade of navigation bar in ViewController

1.5k Views Asked by At

I have embedded my view controller in a navigation controller. I set the background color of the view in my view controller to a color (#ed1c24). And I want the navigation bar also be the same color.

But setting the tint color (same #ed1c24) in the attribute inspector of the navigation controller gives different shade in the view controller as shown in the image. What would be causing this issue?

different shade in navigation bar

2

There are 2 best solutions below

0
Nitish On BEST ANSWER

Along with setting Translucent, use the Style as Black. That would give the correct match with the colour in your view.

enter image description here

0
Arun K On

You are setting the right color the translucency is changing the visual for that color. Use this code to change it

self.navigationController?.navigationBar.isTranslucent = false