Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UINavigationBar default color

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.

like image 523
Jack Greenhill Avatar asked Jan 16 '11 05:01

Jack Greenhill


People also ask

What is default Swift bar color?

Swift 3.0 + You can set the barTintColor to nil to restore to the default white color.

Why is navigation bar black?

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.


1 Answers

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, UIBarButtonItems 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).

like image 121
omz Avatar answered Nov 04 '22 20:11

omz