NYExerciseOptionCell.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // NYExerciseOptionCell.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2024/10/31.
  6. // Copyright © 2024 JCZ. All rights reserved.
  7. //
  8. #import "NYExerciseOptionCell.h"
  9. @interface NYExerciseOptionCell ()
  10. @property (nonatomic, readwrite, strong) NYExerciseOptionItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UILabel *optionLabel;
  12. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *labelHeight;
  13. @end
  14. @implementation NYExerciseOptionCell
  15. #pragma mark - PublicMethods
  16. + (instancetype)cellWithTableView:(UITableView *)tableView {
  17. static NSString *ID = @"NYExerciseOptionCell";
  18. NYExerciseOptionCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  19. if (!cell) {
  20. cell = [self rq_viewFromXib];
  21. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  22. }
  23. return cell;
  24. }
  25. - (void)bindViewModel:(RQExerciseOptionItemViewModel *)viewModel {
  26. @weakify(self)
  27. _viewModel = viewModel;
  28. RAC(self.optionLabel, attributedText) = [[RACObserve(viewModel, optsString) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
  29. RAC(self.labelHeight, constant) = [[RACObserve(viewModel, labelHeight) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
  30. }
  31. #pragma mark - SystemMethods
  32. - (void)awakeFromNib {
  33. [super awakeFromNib];
  34. }
  35. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  36. [super setSelected:selected animated:animated];
  37. }
  38. @end