// // YMAboutUsCell.m // MSYOUPAI // // Created by YoMi on 2024/2/21. // Copyright © 2024 MS. All rights reserved. // #import "YMAboutUsCell.h" #import "YMAboutUsCellViewModel.h" @interface YMAboutUsCell () /// 关于我们VM @property (nonatomic, strong) YMAboutUsCellViewModel *viewModel; /// 基础视图 @property (nonatomic, strong) UIView *baseView; /// 关于我们标题标签 @property (nonatomic, strong) UILabel *aboutUsTitleLb; /// 箭头图标 @property (nonatomic, strong) UIImageView *arrowIcon; @end @implementation YMAboutUsCell - (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 } - (void)ym_setupViews{ [self.contentView addSubview:self.baseView]; [self.baseView addSubview:self.aboutUsTitleLb]; [self.baseView addSubview:self.arrowIcon]; [self setNeedsUpdateConstraints]; [self updateConstraintsIfNeeded]; } - (void)updateConstraints{ [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.contentView); make.left.equalTo(self.contentView); make.right.equalTo(self.contentView); make.bottom.equalTo(self.contentView); }]; [self.aboutUsTitleLb mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.baseView.mas_centerY); make.left.equalTo(self.baseView).offset(adapt(15)); }]; [self.arrowIcon mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.aboutUsTitleLb.mas_centerY); make.right.equalTo(self).offset(adapt(-15)); make.width.mas_equalTo(adapt(10)); make.height.mas_equalTo(adapt(9)); }]; [super updateConstraints]; } - (void)ym_bindViewModel:(YMAboutUsCellViewModel *)viewModel{ if (!viewModel) { return; } _viewModel = viewModel; self.aboutUsTitleLb.text = self.viewModel.aboutUsTitle; } - (UIView *)baseView{ if (!_baseView) { _baseView = [[UIView alloc]init]; } return _baseView; } - (UILabel *)aboutUsTitleLb{ if (!_aboutUsTitleLb) { _aboutUsTitleLb = [[UILabel alloc]init]; _aboutUsTitleLb.font = LCFont(15); _aboutUsTitleLb.textColor = HexColorFromRGB(0x333333); _aboutUsTitleLb.textAlignment = NSTextAlignmentLeft; _aboutUsTitleLb.text = @"功能"; } return _aboutUsTitleLb; } - (UIImageView *)arrowIcon{ if (!_arrowIcon) { _arrowIcon = [[UIImageView alloc]init]; _arrowIcon.image = ImageByName(@"ym_edit_profile_arrow_icon"); } return _arrowIcon; } @end