16進制顏色值宏定義。app
//調用 NSString *str = model.Color; NSString *strColor = [str stringByReplacingOccurrencesOfString:@"#" withString:@""]; NSMutableString *tempHex=[[NSMutableString alloc] init]; [tempHex appendString:strColor]; unsigned colorInt = 0; [[NSScanner scannerWithString:tempHex] scanHexInt:&colorInt]; _cellView.entityLable.textColor = UIColorFromRGB(colorInt); #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]
// 2.得到RGB顏色spa
#define ZFColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] //調用 UIColor * color = ZFColor(251, 251, 251); 251,251,251的RGB顏色值表明白色