iOS开发之oc设置颜色

74 阅读1分钟

//通过RGB设置颜色

#define kRGBColor(R,G,B) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1.0]

/** 色值 RGB **/

#define RGB(r, g, b) RGB_A(r, g, b, 1)

#define RGB_HEX(__h__) RGB((__h__ >> 16) & 0xFF, (__h__ >> 8) & 0xFF, __h__ & 0xFF)

#define RGBOF(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 mainColor RGBOF(0x1F2833)