常用宏定義 - 顏色管理
阿新 • • 發佈:2018-07-15
val color clear fin 透明度 bject 設置 清除 ive
1、RGB顏色,帶透明度的RGB顏色,清除背景顏色
/** rgb顏色轉換(16進制->10進制)*/ #define UIColorFromRGB(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] /** 帶有RGBA的顏色設置 */ #define COLOR(R, G, B, A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A] /** 獲取RGB顏色 */ #define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a] #define RGB(r,g,b) RGBA(r,g,b,1.0f) /** 背景色 */ #define BACKGROUND_COLOR [UIColor colorWithRed:242.0/255.0 green:236.0/255.0 blue:231.0/255.0 alpha:1.0] /** 清除背景色 */ #define CLEARCOLOR [UIColor clearColor] #pragma mark - 顏色方法 #define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1] #define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
常用宏定義 - 顏色管理