使用宏定义根据RGB16进制生成对应的颜色。
#define CCYColorWithHex(hexValue) \
[UIColor colorWithRed:((float)((hexValue & 0xFF0000) >> 16))/255.0 \
green:((float)((hexValue & 0xFF00) >> 8))/255.0 \
blue:((float)(hexValue & 0xFF))/255.0 \
alpha:1.0]
使用:
CCYColorWithHex(0x7c7f81);
网友评论