如何找到UIButton
的当前背景颜色并将该颜色名称存储在NSString
或NSMutableArray中。
答案 0 :(得分:0)
在这里,你去找我的朋友。
UIColor* buttonColor = button.backgroundColor;
NSString* colorString = [buttonColor description];
答案 1 :(得分:0)
但是你可以使用erica sudan的类别
How to get the name of a UIColor?
找到颜色最接近的颜色名称
(免责声明:不是我的代码)
请参阅https://github.com/timd/UIColor-HexValues
它在UIColor上有一个类别,从颜色到十六进制以及从十六进制到颜色
(免责声明:不是我的代码)