UINavigationBar默认颜色 [英] UINavigationBar default color

查看:147
本文介绍了UINavigationBar默认颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道UINavigationBar的默认颜色是什么(在iPhone上)。



我在任何地方找不到它,并调用



例如: cb> c> ,如果我以编程方式将颜色设置为,让我们说,红色,我该如何恢复正常?



任何帮助赞赏。

解决方案

要获得默认外观,您可以将 tintColor 设置为 nil c>。



无法将其设置为 UIColor 的实例,看起来完全与默认样式相同,因为按钮颜色在默认样式中略有不同。例如,Done按钮样式的 UIBarButtonItem s的颜色与显式设置颜色不同于颜色条本身默认颜色的颜色不同。 p>

另请注意,iPad上的默认色调颜色不同(在将来的iOS版本中可能会更改)。


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.

解决方案

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

这篇关于UINavigationBar默认颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆