开发者

UINavigationBar default color

开发者 https://www.devze.com 2023-02-04 18:36 出处:网络
I\'m just wondering what UINavigationBar\'sdefault color is (on the iPhone). I can\'t find it anywhere, and calling C开发者_如何学CGColorGetComponents() on navigationBar.tintColor.CGColorRef has no e

I'm just wondering what UINavigationBar's default color is (on the iPhone).

I can't find it anywhere, and calling C开发者_如何学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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号