1.直接使用
[UIColor colorWithRed:(CGFloat)0xa9/0xff green:(CGFloat)0xa7/0xff blue:(CGFloat)0xa7/0xff alpha:1.0];
2.宏定義
// rgb顏色轉(zhuǎn)換(16進(jìn)制->10進(jìn)制)
#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]