123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //
- // 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
|