美文网首页
iOS 自定义view的宏

iOS 自定义view的宏

作者: 风___________ | 来源:发表于2019-05-08 19:49 被阅读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
    

    相关文章

      网友评论

          本文标题:iOS 自定义view的宏

          本文链接:https://www.haomeiwen.com/subject/maovoqtx.html