85 lines
2.5 KiB
Objective-C
85 lines
2.5 KiB
Objective-C
//
|
|
// XPMineSwitchLanguageCell.m
|
|
// YuMi
|
|
//
|
|
// Created by duoban on 2024/4/9.
|
|
//
|
|
|
|
#import "XPMineSwitchLanguageCell.h"
|
|
@interface XPMineSwitchLanguageCell()
|
|
@property(nonatomic,strong) UILabel *textView;
|
|
@property(nonatomic,strong) UIView *lineView;
|
|
@property(nonatomic,strong) UIImageView *chooseView;
|
|
@end
|
|
@implementation XPMineSwitchLanguageCell
|
|
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
|
|
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
|
if(self){
|
|
[self installUI];
|
|
[self installConstraints];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
-(void)installUI{
|
|
self.contentView.backgroundColor = [UIColor whiteColor];
|
|
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
[self.contentView addSubview:self.textView];
|
|
[self.contentView addSubview:self.lineView];
|
|
[self.contentView addSubview:self.chooseView];
|
|
}
|
|
-(void)installConstraints{
|
|
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(kGetScaleWidth(16));
|
|
make.centerY.equalTo(self.contentView);
|
|
}];
|
|
[self.chooseView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.height.mas_equalTo(kGetScaleWidth(16));
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(16));
|
|
make.centerY.equalTo(self.contentView);
|
|
}];
|
|
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(0.5);
|
|
make.bottom.mas_equalTo(-kGetScaleWidth(0));
|
|
make.leading.trailing.equalTo(self.contentView).inset(kGetScaleWidth(20));
|
|
}];
|
|
}
|
|
- (void)setModel:(XPMineSettingItemModel *)model{
|
|
_model = model;
|
|
_chooseView.hidden = !_model.isChoose;
|
|
_textView.text = _model.title;
|
|
}
|
|
#pragma mark - 懒加载
|
|
- (UILabel *)textView{
|
|
if(!_textView){
|
|
_textView = [UILabel labelInitWithText:@"" font:kFontRegular(16) textColor:UIColorFromRGB(0x1F1B4F)];
|
|
}
|
|
return _textView;
|
|
}
|
|
- (UIView *)lineView{
|
|
if(!_lineView){
|
|
_lineView = [UIView new];
|
|
_lineView.backgroundColor = UIColorFromRGB(0xEBEEF5);
|
|
}
|
|
return _lineView;
|
|
}
|
|
- (UIImageView *)chooseView{
|
|
if(!_chooseView){
|
|
_chooseView = [UIImageView new];
|
|
_chooseView.image = kImage(@"pi_mine_set_language_choose") ;
|
|
}
|
|
return _chooseView;
|
|
}
|
|
- (void)awakeFromNib {
|
|
[super awakeFromNib];
|
|
// Initialization code
|
|
}
|
|
|
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
|
[super setSelected:selected animated:animated];
|
|
|
|
// Configure the view for the selected state
|
|
}
|
|
|
|
@end
|