YMAccountBalanceRechargeNotesView.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // YMAccountBalanceRechargeNotesView.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/3/6.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMAccountBalanceRechargeNotesView.h"
  9. #import "YMAccountBalanceViewModel.h"
  10. @interface YMAccountBalanceRechargeNotesView ()<UIGestureRecognizerDelegate>
  11. /// 账号余额VM
  12. @property (nonatomic, strong) YMAccountBalanceViewModel *viewModel;
  13. /// 充值说明标签
  14. @property (nonatomic, strong) YYLabel *rechargeNotesLb;
  15. @end
  16. @implementation YMAccountBalanceRechargeNotesView
  17. - (void)ym_setupViews{
  18. [self addSubview:self.rechargeNotesLb];
  19. [self setNeedsUpdateConstraints];
  20. [self updateConstraintsIfNeeded];
  21. }
  22. - (void)updateConstraints{
  23. [self.rechargeNotesLb mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.top.equalTo(self).offset(adapt(10));
  25. make.left.equalTo(self);
  26. make.right.equalTo(self);
  27. make.bottom.equalTo(self).offset(adapt(-10));
  28. }];
  29. [super updateConstraints];
  30. }
  31. - (void)ym_bindViewModel:(YMAccountBalanceViewModel *)viewModel{
  32. if (!viewModel) {
  33. return;
  34. }
  35. _viewModel = viewModel;
  36. RAC(self.rechargeNotesLb, attributedText) = RACObserve(self.viewModel, rechargeNotes);
  37. }
  38. - (YYLabel *)rechargeNotesLb{
  39. if (!_rechargeNotesLb) {
  40. _rechargeNotesLb = [[YYLabel alloc]init];
  41. _rechargeNotesLb.font = LCFont(11);
  42. _rechargeNotesLb.textColor = HexColorFromRGB(0x9b9b9b);
  43. _rechargeNotesLb.textAlignment = NSTextAlignmentLeft;
  44. _rechargeNotesLb.numberOfLines = 0;
  45. }
  46. return _rechargeNotesLb;
  47. }
  48. @end