您的位置:首页 > 其它

颜色设置的宏定义

2015-11-26 21:13 344 查看
//通过Red,Greed,Blue设置颜色值

#define UIColorWithRGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.0f
green:(g)/255.0f
blue:(b)/255.0f
alpha:(a)]

#define UIColorWithRGB(r,g,b) UIColorWithRGBA(r,g,b,1.0)

//通过16进制设置颜色值

#define UIColorWithHexA(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue &
0xFF0000) >>
16))/255.0
\

green:((float)((rgbValue &
0xFF00) >>
8))/255.0
\

blue:((float)(rgbValue &
0xFF))/255.0
\

alpha:(a)]
#define UIColorWithHex(rgbValue) UIColorWithHexA(rgbValue,1.0)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: