iOS开发 颜色值, 设置color

#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);

你可能感兴趣的:(iOS开发 颜色值, 设置color)