iOS开发 颜色值, 设置color
2017-05-22 本文已影响64人
王誌傑
#define FUIColorFromRGB(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]
//假如颜色值是 #f9f9f9 使用方法如下
NSString* colorString = [@"#f9f9f9"stringByReplacingOccurrencesOfString:@"#"withString:@"0x"];;
unsignedlongcolor =strtoul([colorStringUTF8String],0,0);
backVieww.backgroundColor = FUIColorFromRGB(color);