Pch文件内添加:
1.Log()设置:
#ifdef DEBUG // 调试阶段 #define CHLog(...) NSLog(@"%s %d %@", __func__, __LINE__, [NSString stringWithFormat:__VA_ARGS__]) #else // 发布阶段 #define CHLog(...) #endif
如果嫌打印太多可设置为:
#define CHLog(...) NSLog(__VA_ARGS__)
2.随机颜色设置:
#define CHColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] // 随机颜色 #define CHRandomColor CHColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))