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 so
Add 20 in your RGB to get the desired output. eg. My navbar and UIView in UIViewController RGB was (66,66,167)
I incremented the All RGB's to (86,86,187) to get the same output
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.
FOR FURTHER READERS
If none of solutions worked for you try to check this one.
Probably you have set the background color of your view controller in the Storyboard using Generic RGB which differs from sRGB used in UIColor class since iOS 10 SDK.
I've tried every solution, mentioned in the answers here. But nothing solved it completly. I found this:
First of all you have to have to select the navigationbar and disable the Translucent Checkbox. It's right at the top.
After this is done. The BackgroundColor is still wrong. So don't set the BackgroundColor, set the TintColor of the NavBar. You can do this on the same way like the Translucent. The possibility to set the TintColor is 2 elements under the Translucent Checkbox.
Or you set it using swift or objC:
self.navigationController?.navigationBar.isTranslucent = false
navBar.barTintColor = UIColor.CustomColor.colorPrimary
navigationBar.barStyle = UIBarStyle.blackOpaque
Worked to prevent undesired blending with the background, when none of the previous answers worked (in iOS 9.3).
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;