CNLiveSelectSubView.m 1.53 KB
//
//  CNLiveSelectSubView.m
//  CNLiveMyOrder
//
//  Created by 殷巧娟 on 2019/6/12.
//

#import "CNLiveSelectSubView.h"
#import "CNLiveBaseKit.h"
@interface CNLiveSelectSubView ()
{
    NSString *_imgName;
    NSString *_title;
}
@property (nonatomic, strong) UIImageView *subImgView;
@property (nonatomic, strong) UILabel *titleLab;
@end

@implementation CNLiveSelectSubView
- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title imgName:(NSString *)imgName
{
    self = [super initWithFrame:frame];
    if (self) {
        _title = title;
        _imgName = imgName;
        [self initSubView];
    }
    return self;
}

- (void)initSubView {
    
    [self addSubview:self.subImgView];
    self.subImgView.centerX = self.width*0.5;
    [self addSubview:self.titleLab];
    self.titleLab.top = self.subImgView.bottom+15;
}

- (void)reloadUI {
    
    self.titleLab.font = UIFontCNMake(12);
}

- (UIImageView *)subImgView {
    if (!_subImgView) {
        _subImgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 15, 26, 26)];
        _subImgView.contentMode = UIViewContentModeScaleAspectFit;
        _subImgView.image = [UIImage imageNamed:_imgName];
    }
    return _subImgView;
}

- (UILabel *)titleLab {
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.width, 14)];
        _titleLab.text = _title;
        _titleLab.textColor = RGBA(46, 45, 45, 1);
        _titleLab.font = UIFontCNMake(12);
        _titleLab.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLab;
}



@end