-->

如何获得的UIColor的名字吗?(How to get the name of a UIColor

2019-10-17 21:30发布

我有这样UIColors的阵列

[UIColor blueColor];

是否有可能从的UIColor获得命名为“蓝色”,将字符串中的显示呢?

Answer 1:

没有什么内置在UIKit中的,但埃里卡Sadun的的UIColor的实用程序库增加了类似的功能。



Answer 2:

你可以得到RGB和Alpha的的UIColor的,如果你想要的。



Answer 3:

可以使用获得的色彩名称的列表runtime 。 见我的问题: 如何获得的UIColor的所有颜色的方法呢?

您还可以使用字符串方法,将'xxxColor''xxx'如果需要的话。



文章来源: How to get the name of a UIColor?