Reputation: 1718
I am currently working on an iOS Application in Swift 3 and wanted to change the color of my NavigationBar
with the following code:
self.navigationController?.navigationBar.barTintColor = UIColor.init(red: 53.0/255.0, green: 70.0/255.0, blue: 90.0/255.0, alpha: 1.0)
This code works quite fine but there's one problem. The color I entered in RGB format is displayed wrong.
But looks like this (left: is current Color () right: as already said should look like):
Upvotes: 1
Views: 539
Reputation: 4995
Change navigation bar to Opaque instead of Translucent.
Swift
self.navigationController?.navigationBar.isTranslucent = true
Objective-C
[[UINavigationBar appearance] setTranslucent:YES];
Please find in image.
And if you are setting navigations background color then change navigation background color instead of tint color.
Upvotes: 0
Reputation: 2269
Set navigationController?.navigationBar.isTranslucent = false.
You can also achieve this by unchecking Translucent from storyboard.
Upvotes: 3