| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- //
- // MOLanguageItemCell.m
- // MiMoLive
- //
- // Created by SuperC on 2023/10/9.
- //
- #import "MOLanguageItemCell.h"
- @implementation MOLanguageItemCell
- - (instancetype)initWithFrame:(CGRect)frame
- {
- if (self = [super initWithFrame:frame])
- {
- self.backgroundColor = [UIColor clearColor];
- self.contentView.backgroundColor = [UIColor clearColor];
- [self setupUI];
- }
- return self;
- }
- - (void)setupUI
- {
- [self bgView];
-
- self.bgView.layer.cornerRadius = 15;
- self.bgView.layer.masksToBounds = YES;
-
- [self.bgView addSubview:self.iconImgView];
- [self.iconImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(9);
- make.centerY.mas_equalTo(0);
- make.size.mas_equalTo(CGSizeMake(16, 16));
- }];
-
- [self.bgView addSubview:self.titleLab];
- [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.mas_equalTo(0);
- make.height.greaterThanOrEqualTo(@16.0);
- }];
-
- // [self.bgView addSubview:self.selectImg];
- // [self.selectImg mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.width.height.equalTo(@18.0);
- // make.top.equalTo(self.bgView).offset(-9.0);
- // make.right.equalTo(self.bgView).offset(9.0);
- // }];
- }
- - (void)setModel:(MOCountryList *)model{
- _model = model;
-
- self.titleLab.text = model.name;
- [self.iconImgView sd_setImageWithURL:[NSURL URLWithString:model.icon2]];
- if(model.isChoose)
- {
- self.bgView.backgroundColor = [MOTools colorWithHexString:@"#0BDDFC" alpha:1.0];
- self.titleLab.textColor = [MOTools colorWithHexString:@"#282828" alpha:1.0];
- // self.selectImg.hidden = NO;
-
- }
- else
- {
- self.bgView.backgroundColor = [UIColor clearColor];
- self.titleLab.textColor = [MOTools colorWithHexString:@"#ABABAB" alpha:1.0];
- // self.selectImg.hidden = YES;
-
- }
- }
- - (UIView *)bgView
- {
- if (!_bgView)
- {
- _bgView = [[UIView alloc] init];
- _bgView.backgroundColor = [UIColor clearColor];
- [self.contentView addSubview:_bgView];
- [_bgView mas_makeConstraints:^(MASConstraintMaker *make)
- {
- make.edges.equalTo(self.contentView);
- }];
- }
- return _bgView;
- }
- - (UIImageView *)iconImgView {
- if (!_iconImgView) {
- _iconImgView = [[UIImageView alloc] init];
- _iconImgView.contentMode = UIViewContentModeScaleAspectFill;
- _iconImgView.layer.cornerRadius = 8;
- _iconImgView.layer.masksToBounds = YES;
- }
- return _iconImgView;
- }
- - (UILabel *)titleLab
- {
- if (!_titleLab)
- {
- _titleLab = [[UILabel alloc] init];
- _titleLab.text = @"";
- _titleLab.font = [MOTextTools getTheFontWithSize:18.0 AndFontName:kNormalContentFontStr];
- _titleLab.textColor = [MOTools colorWithHexString:@"#ABABAB" alpha:1.0];
- _titleLab.textAlignment = NSTextAlignmentCenter;
- _titleLab.numberOfLines = 0;
-
- }
- return _titleLab;
- }
- - (UIImageView *)selectImg
- {
- if (!_selectImg)
- {
- _selectImg = [[UIImageView alloc] init];
- _selectImg.clipsToBounds = YES;
- _selectImg.userInteractionEnabled = NO;
- _selectImg.hidden = YES;
- [_selectImg setImage:[UIImage imageNamed:@""]];
- _selectImg.contentMode = UIViewContentModeScaleAspectFill;
- }
- return _selectImg;
- }
- @end
|