iOS中RGB常用的色值,同时可将对颜色的设置定义成宏,方便开发应用,如:
- // @name 颜色相关
- // 参数格式为:0xFFFFFF
- #define kColorWithRGB(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]
- // 参数格式为:222,222,222
- #define kColorWithRGB(r, g, b) [UIColor colorWithRed:(r) / 255.f green:(g) / 255.f blue:(b) / 255.f alpha:1.f]
- // @end