代码规范与常用宏

标记

#pragma mark - Lift Cycle
#pragma mark - RequestData
#pragma mark - HandleData
#pragma mark - Setter&Getter  Methods
#pragma mark - OBJMethods
#pragma mark - LoadMore
#pragma mark - Refresh
#pragma mark - 

效果图


代码规范与常用宏_第1张图片
Snip20160803_1.png

NSLog打印

  • 打印方式一
#ifdef DEBUG
#define HHLog(...) NSLog(__VA_ARGS__)
#else
#define HHLog(...)
#endif
//打印与之对应调用方法
#define HHLogFunc HHLog(@"%s",__func__)
  • 打印方式二
#ifdef DEBUG
#define HHLog(format, ...) do { \
       fprintf(stderr, "<%s : %d> %sn",\
        [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],\
        __LINE__, __func__);\
(NSLog)((format), ##__VA_ARGS__);\
fprintf(stderr, "-------n");\
} while (0)
#endif

常用宏

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

//整个项目的背景色值
#define HHGlobalBg HHRGBColor(223, 223, 223)

//获取物理尺寸
#define ScreenWidth  [UIScreen mainScreen].bounds.size.width
#define ScreenHeight  [UIScreen mainScreen].bounds.size.height

你可能感兴趣的:(代码规范与常用宏)