我想复制 UITextField 占位符字段的默认颜色。来自文档:
The placeholder string is drawn using a 70% grey color.
- 这句话中的 70% 是什么意思?
- 用这种颜色初始化 UIColor 的最佳方式是什么,最好是显示颜色为“70% 灰色”的方式?
最佳答案
这是 70% 的灰色:
UIColor* grey70 = [UIColor colorWithWhite: 0.70 alpha:1];
它是白色的,但只有最大亮度 (1.0) 的 70%。
1.0是纯白, 0.5为中灰, 0.0 为黑色。
关于ios - 70% 灰色是什么意思,我如何在 UIColor 中指定它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9218755/