OC: 宏定义, 例子

OC: 宏定义, 例子

对的

#define RGBAlpha(r, g, b, a)  [[UIColor colorWithRed:(r) / 255.0 green:(g) / 255.0 blue:(b) / 255.0 alpha:(a) ] set]





    RGBAlpha(85, 26, 19, 0.5);

错的

#define RGBAlphaWrong(r, g, b, alpha)  [[UIColor colorWithRed:(r) / 255.0 green:(g) / 255.0 blue:(b) / 255.0 alpha:(alpha) ] set]



    RGBAlphaWrong(85, 26, 19, 0.5);  // Messg: Expected ']'

你可能感兴趣的:(OC: 宏定义, 例子)