3
votes

In my app, I am using the following color: #3D6D86

It is set to be a background color on a view controller and also to be the color for the navigation bar on a different view controller. However the problem is that the color appears different. I converted the hex to the correct type of UIColor notation for use with swift so I can't see the issue being there either. I will attach some screenshots below to show you what I mean:

enter image description hereenter image description here

-----------EDIT-----------

Now when I use this code to try and remove translucency: UINavigationBar.appearance().translucent = false UINavigationBar.appearance().barTintColor = UIColor(red:0.24, green:0.43, blue:0.53, alpha:1.0)

I am left with a white gap between the navigation bar and the image which should be below it. Any ideas?

2
In IOS 8, the nav bar is transgluent by default. your nav bar add this differenceMasterfego
The background color of the top screenshot is #305A73, the background color of the bottom screenshot is #598398.bames53
Try HSBA: #3D6D86 is equal to UIColor(hue: 0.5571, saturation: 0.5448, brightness: 0.5255, alpha: 1.0) // #3D6D86ixany

2 Answers

7
votes

Because of the blurring effect on a translucent UINavigationBar, the color you set is not exactly how it will be displayed on screen. You can either set your navigation bar's translucent property to NO:

self.navigationController.navigationBar.translucent = NO;

... or use this handy calculator to work out the correct input color to get your desired color on-screen:

0
votes

To fix this you can set navigationbar's translucent in viewDidLoad :

[self.navigationController.navigationBar setTranslucent:NO];