关于颜色的宏定义.

#define RGB(r, g, b)
    [UIColor colorWithRed:r/256.0 green:g/256.0 blue:b/256.0 alpha:1]
#define RGBA(r, g, b, a)
    [UIColor colorWithRed:r/256.0 green:g/256.0 blue:b/256.0 alpha:a]

// Code without the macro
  msgLabel.textColor =
     [UIColor colorWithRed:255/256.0 green:251/256.0 blue:204/256.0 alpha:1];
 
  // Or like this...
  msgLabel.textColor = [UIColor colorWithRed:1.0 green:.98 blue:.8 alpha:1];
 
// Code with macro
  msgLabel.textColor = RGB(255, 251, 204);

posted @ 2009-06-17 10:49  小糊涂的超级blog  阅读(442)  评论(0编辑  收藏  举报