iOS 自定义view的宏

2019-05-08  本文已影响0人  风___________

// 自定义 UIView
#ifndef CF_CUSTOMERVIEW_VIEW
#define CF_CUSTOMERVIEW_VIEW \
- (instancetype)initWithCoder:(NSCoder *)aDecoder{\
    self = [super initWithCoder:aDecoder];\
    if (self) {\
        [self bankViewInit];\
    }\
    return self;\
}\
- (instancetype)init{\
    self =  [super init];\
    if (self) {\
        [self bankViewInit];\
    }\
    return self;\
}\
- (instancetype)initWithFrame:(CGRect)frame{\
    self = [super initWithFrame:frame];\
    if (self) {\
        [self bankViewInit];\
    }\
    return self;\
}
#endif

// 自定义 UITableViewCell
#ifndef CF_CUSTOMERVIEW_TABLEVIEW_CELL
#define CF_CUSTOMERVIEW_TABLEVIEW_CELL \
- (instancetype)initWithCoder:(NSCoder *)aDecoder{\
    self = [super initWithCoder:aDecoder];\
    if (self) {\
        [self bankViewInit];\
    }\
    return self;\
}\
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{\
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {\
        [self bankViewInit];\
    }\
    return self;\
}\
- (instancetype)initWithFrame:(CGRect)frame{\
    if (self = [super initWithFrame:frame]) {\
        [self bankViewInit];\
    }\
    return self;\
}
#endif

// 自定义 UITableViewHeaderFooterView
#ifndef CF_CUSTOMERVIEW_TABLEVIEW_HEADERFOOTERVIEW
#define CF_CUSTOMERVIEW_TABLEVIEW_HEADERFOOTERVIEW \
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{\
    self = [super initWithReuseIdentifier:reuseIdentifier];\
    if (self) {\
        [self bankViewInit];\
    }\
    return self;\
}\
- (instancetype)initWithCoder:(NSCoder *)aDecoder{\
    self = [super initWithCoder:aDecoder];\
    if (self) {\
        [self bankViewInit];\
    }\
    return self;\
}\
- (instancetype)initWithFrame:(CGRect)frame{\
    if (self = [super initWithFrame:frame]) {\
        [self bankViewInit];\
    }\
    return self;\
}
#endif
上一篇下一篇

猜你喜欢

热点阅读