16进制颜色值转换使用

#define UIColorFromRGBA(rgbValue, alphaValue) \

[UIColor \

  colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \

         green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \

          blue:((float)(rgbValue & 0x0000FF))/255.0 \

         alpha:alphaValue]

 使用:

X.backgroundColor = [UIColorFromRGBA(0x0000FF, .75) CGColor];

posted @ 2013-01-05 11:19  燕羽天空  Views(247)  Comments(0Edit  收藏  举报