UINavigationBar default color

本秂侑毒 提交于 2019-12-08 15:07:51

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/4704081/uinavigationbar-default-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!