I'm just wondering what UINavigationBar's default color is (on the iPhone).
I can't find it anywhere, and calling CGColorGetComponents()
on navigationBar.tintColor.CGColorRef
has no effect.
For example, if I programmatically set the color to, let's say, red, how do I get it back to normal?
Any help appreciated.
Swift 3.0 + You can set the barTintColor to nil to restore to the default white color.
One of the issues that can occur is coloring the nav bar when your keyboard is open for typing. To fix this, head into General Settings –> Color of Navigation Bar when Keyboard is opened. Set this color to black as well. This should fix any issues you may have when the keyboard is open.
To get the default look, you'd set the tintColor
to nil
.
It's not possible to set it to an instance of UIColor
and have it look completely the same as in the default style, because the button colors are slightly different in the default look. For example, UIBarButtonItem
s with 'Done' button style have a different color than when you explicitly set a tint color that would otherwise resemble the default color of the bar itself.
Also note that the default tint color is different on iPad (and might change in future versions of iOS).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With