第1个回答 2014-04-26
楼上的是16进制表示法,下面是rgb表示法的转换,大同小异。#define UIColorFromRGB2(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0] 查看原帖>>本回答被提问者采纳
第2个回答 2014-04-26
//RGB color macro#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]//RGB color macro with alpha#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor \colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \blue:((float)(rgbValue & 0xFF))/255.0 alpha:a] 查看原帖>>