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

2018-11-03  本文已影响0人  lifeLL
@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
上一篇 下一篇

猜你喜欢

热点阅读