iOS 常用宏

//如果有Debug这个宏的话,就允许log输出...可变参数
#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#else
#define NSLog(...)
#endif

//快捷输入颜色
#define ICE_COLOR(r,g,b,a) [UIColor colorWithRed:r / 255.0 green:g / 255.0 blue:b / 255.0 alpha:a]
//随机色
#define ICE_RANDOMCOLOR [UIColor colorWithRed: arc4random() % 256 / 255.0 green: arc4random() % 256 / 255.0 blue: arc4random() % 256 / 255.0 alpha:1]

//系统版本号
#define SYSTEMVERSION [[[UIDevice currentDevice] systemVersion] floatValue]

#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height
#define BOUNDS [UIScreen mainScreen].bounds

你可能感兴趣的:(iOS 常用宏)