iOS 调试用Log()与随机颜色设置

Pch文件内添加:

1.Log()设置:

#ifdef DEBUG // 调试阶段
#define CHLog(...) NSLog(@"%s %d\n %@", __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))
posted @ 2015-08-08 21:12  HappyPlane  阅读(277)  评论(0编辑  收藏  举报