美文网首页
view的初始化及控件的懒加载

view的初始化及控件的懒加载

作者: lifeLL | 来源:发表于2018-11-03 11:06 被阅读0次
@implementation PGIndexBannerSubiew
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.mainImageView];
        [self addSubview:self.coverView];
    }
    return self;
}
- (UIImageView *)mainImageView {
    
    if (_mainImageView == nil) {
        _mainImageView = [[UIImageView alloc] initWithFrame:self.bounds];
        _mainImageView.userInteractionEnabled = YES;
    }
    return _mainImageView;
}

@end

相关文章

网友评论

      本文标题:view的初始化及控件的懒加载

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