YMFeesSettingCell.m 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //
  2. // YMFeesSettingCell.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/2/23.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMFeesSettingCell.h"
  9. #import "YMFeesSettingCellViewModel.h"
  10. @interface YMFeesSettingCell ()
  11. /// 收费设置价格VM
  12. @property (nonatomic, strong) YMFeesSettingCellViewModel *viewModel;
  13. /// 基础视图
  14. @property (nonatomic, strong) UIView *baseView;
  15. /// 收费设置标题标签
  16. @property (nonatomic, strong) UILabel *feesSettingTitleLb;
  17. /// 收费设置内容标签
  18. @property (nonatomic, strong) UILabel *feesSettingContentLb;
  19. /// 箭头图标
  20. @property (nonatomic, strong) UIImageView *arrowIcon;
  21. @end
  22. @implementation YMFeesSettingCell
  23. - (void)awakeFromNib {
  24. [super awakeFromNib];
  25. // Initialization code
  26. }
  27. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  28. [super setSelected:selected animated:animated];
  29. // Configure the view for the selected state
  30. }
  31. - (void)ym_setupViews{
  32. [self.contentView addSubview:self.baseView];
  33. [self.baseView addSubview:self.feesSettingTitleLb];
  34. [self.baseView addSubview:self.feesSettingContentLb];
  35. [self.baseView addSubview:self.arrowIcon];
  36. [self setNeedsUpdateConstraints];
  37. [self updateConstraintsIfNeeded];
  38. }
  39. - (void)updateConstraints{
  40. [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.top.equalTo(self.contentView);
  42. make.left.equalTo(self.contentView);
  43. make.right.equalTo(self.contentView);
  44. make.bottom.equalTo(self.contentView);
  45. }];
  46. [self.feesSettingTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.centerY.equalTo(self.baseView.mas_centerY);
  48. make.left.equalTo(self.baseView).offset(adapt(15));
  49. }];
  50. [self.feesSettingContentLb mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.centerY.equalTo(self.feesSettingTitleLb.mas_centerY);
  52. make.right.equalTo(self.arrowIcon.mas_left).offset(adapt(-10));
  53. }];
  54. [self.arrowIcon mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.centerY.equalTo(self.feesSettingTitleLb.mas_centerY);
  56. make.right.equalTo(self).offset(adapt(-15));
  57. make.width.mas_equalTo(adapt(10));
  58. make.height.mas_equalTo(adapt(9));
  59. }];
  60. [super updateConstraints];
  61. }
  62. - (void)ym_bindViewModel:(YMFeesSettingCellViewModel *)viewModel{
  63. if (!viewModel) {
  64. return;
  65. }
  66. _viewModel = viewModel;
  67. self.feesSettingTitleLb.text = self.viewModel.feesSettingTitle;
  68. self.feesSettingContentLb.text = self.viewModel.feesSettingContent;
  69. }
  70. - (UIView *)baseView{
  71. if (!_baseView) {
  72. _baseView = [[UIView alloc]init];
  73. }
  74. return _baseView;
  75. }
  76. - (UILabel *)feesSettingTitleLb{
  77. if (!_feesSettingTitleLb) {
  78. _feesSettingTitleLb = [[UILabel alloc]init];
  79. _feesSettingTitleLb.font = LCFont(15);
  80. _feesSettingTitleLb.textColor = HexColorFromRGB(0x333333);
  81. _feesSettingTitleLb.textAlignment = NSTextAlignmentLeft;
  82. _feesSettingTitleLb.text = @"功能";
  83. }
  84. return _feesSettingTitleLb;
  85. }
  86. - (UILabel *)feesSettingContentLb{
  87. if (!_feesSettingContentLb) {
  88. _feesSettingContentLb = [[UILabel alloc]init];
  89. _feesSettingContentLb.font = LCFont(13);
  90. _feesSettingContentLb.textColor = HexColorFromRGB(0x9c9c9c);
  91. _feesSettingContentLb.textAlignment = NSTextAlignmentRight;
  92. }
  93. return _feesSettingContentLb;
  94. }
  95. - (UIImageView *)arrowIcon{
  96. if (!_arrowIcon) {
  97. _arrowIcon = [[UIImageView alloc]init];
  98. _arrowIcon.image = ImageByName(@"ym_edit_profile_arrow_icon");
  99. }
  100. return _arrowIcon;
  101. }
  102. @end