YMIncomeBreakdownListSectionView.m 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // YMIncomeBreakdownListSectionView.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/3/3.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMIncomeBreakdownListSectionView.h"
  9. #import "YMIncomeBreakdownListPointsAndEarningsSectionViewModel.h"
  10. @interface YMIncomeBreakdownListSectionView ()
  11. /// 收支明细-分组VM
  12. @property (nonatomic, strong) YMIncomeBreakdownListPointsAndEarningsSectionViewModel *viewModel;
  13. /// 基础视图
  14. @property (nonatomic, strong) UIView *baseView;
  15. /// 功能标签
  16. @property (nonatomic, strong) UILabel *sectionTitleLb;
  17. @end
  18. @implementation YMIncomeBreakdownListSectionView
  19. - (void)ym_setupViews{
  20. self.contentView.backgroundColor = UIColor.clearColor;
  21. [self.contentView addSubview:self.baseView];
  22. [self.baseView addSubview:self.sectionTitleLb];
  23. [self setNeedsUpdateConstraints];
  24. [self updateConstraintsIfNeeded];
  25. }
  26. - (void)updateConstraints{
  27. [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.top.equalTo(self.contentView);
  29. make.left.equalTo(self.contentView);
  30. make.right.equalTo(self.contentView);
  31. make.bottom.equalTo(self.contentView);
  32. }];
  33. [self.sectionTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.centerY.equalTo(self.baseView.mas_centerY);
  35. make.left.equalTo(self.baseView).offset(adapt(15));
  36. }];
  37. [super updateConstraints];
  38. }
  39. - (void)ym_bindViewModel:(YMIncomeBreakdownListPointsAndEarningsSectionViewModel *)viewModel{
  40. if (!viewModel) {
  41. return;
  42. }
  43. _viewModel = viewModel;
  44. self.sectionTitleLb.text = self.viewModel.sectionTitle;
  45. }
  46. - (UIView *)baseView{
  47. if (!_baseView) {
  48. _baseView = [[UIView alloc]init];
  49. _baseView.backgroundColor = UIColor.whiteColor;
  50. }
  51. return _baseView;
  52. }
  53. - (UILabel *)sectionTitleLb{
  54. if (!_sectionTitleLb) {
  55. _sectionTitleLb = [[UILabel alloc]init];
  56. _sectionTitleLb.font = LCFont(11);
  57. _sectionTitleLb.textColor = HexColorFromRGB(0x9c9c9c);
  58. _sectionTitleLb.textAlignment = NSTextAlignmentLeft;
  59. _sectionTitleLb.text = @"******";
  60. }
  61. return _sectionTitleLb;
  62. }
  63. @end