// 取色值相关的方法
#define RGB(r,g,b) [UIColor colorWithRed:(r)/255.f \green:(g)/255.f \blue:(b)/255.f \alpha:1.f]
#define RGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.f \green:(g)/255.f \blue:(b)/255.f \alpha:(a)]
//六位十六进制 色值
#define RGB_OF(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 \alpha:1.0]
//八位十六进制色值
#define RGBA_OF(rgbValue) [UIColor colorWithRed:((float)(((rgbValue) & 0xFF000000) >> 24))/255.0 \
green:((float)(((rgbValue) & 0x00FF0000) >> 16))/255.0 \blue:((float)(rgbValue & 0x0000FF00) >> 8)/255.0 \alpha:((float)(rgbValue & 0x000000FF))/255.0]
色值的封装方法以及RGB和RGBA的区别
最新推荐文章于 2024-10-08 17:17:36 发布