123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- //
- // YMFeesSettingCell.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/2/23.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMFeesSettingCell.h"
- #import "YMFeesSettingCellViewModel.h"
- @interface YMFeesSettingCell ()
- /// 收费设置价格VM
- @property (nonatomic, strong) YMFeesSettingCellViewModel *viewModel;
- /// 基础视图
- @property (nonatomic, strong) UIView *baseView;
- /// 收费设置标题标签
- @property (nonatomic, strong) UILabel *feesSettingTitleLb;
- /// 收费设置内容标签
- @property (nonatomic, strong) UILabel *feesSettingContentLb;
- /// 箭头图标
- @property (nonatomic, strong) UIImageView *arrowIcon;
- @end
- @implementation YMFeesSettingCell
- - (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.feesSettingTitleLb];
- [self.baseView addSubview:self.feesSettingContentLb];
- [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.feesSettingTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.baseView.mas_centerY);
- make.left.equalTo(self.baseView).offset(adapt(15));
- }];
-
- [self.feesSettingContentLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.feesSettingTitleLb.mas_centerY);
- make.right.equalTo(self.arrowIcon.mas_left).offset(adapt(-10));
- }];
-
- [self.arrowIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.feesSettingTitleLb.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:(YMFeesSettingCellViewModel *)viewModel{
- if (!viewModel) {
- return;
- }
-
- _viewModel = viewModel;
-
- self.feesSettingTitleLb.text = self.viewModel.feesSettingTitle;
- self.feesSettingContentLb.text = self.viewModel.feesSettingContent;
- }
- - (UIView *)baseView{
- if (!_baseView) {
- _baseView = [[UIView alloc]init];
- }
- return _baseView;
- }
- - (UILabel *)feesSettingTitleLb{
- if (!_feesSettingTitleLb) {
- _feesSettingTitleLb = [[UILabel alloc]init];
- _feesSettingTitleLb.font = LCFont(15);
- _feesSettingTitleLb.textColor = HexColorFromRGB(0x333333);
- _feesSettingTitleLb.textAlignment = NSTextAlignmentLeft;
- _feesSettingTitleLb.text = @"功能";
- }
- return _feesSettingTitleLb;
- }
- - (UILabel *)feesSettingContentLb{
- if (!_feesSettingContentLb) {
- _feesSettingContentLb = [[UILabel alloc]init];
- _feesSettingContentLb.font = LCFont(13);
- _feesSettingContentLb.textColor = HexColorFromRGB(0x9c9c9c);
- _feesSettingContentLb.textAlignment = NSTextAlignmentRight;
- }
- return _feesSettingContentLb;
- }
- - (UIImageView *)arrowIcon{
- if (!_arrowIcon) {
- _arrowIcon = [[UIImageView alloc]init];
- _arrowIcon.image = ImageByName(@"ym_edit_profile_arrow_icon");
- }
- return _arrowIcon;
- }
- @end
|