// // NYExerciseOptionCell.m // jiaPei // // Created by Ning.ge on 2024/10/31. // Copyright © 2024 JCZ. All rights reserved. // #import "NYExerciseOptionCell.h" @interface NYExerciseOptionCell () @property (nonatomic, readwrite, strong) NYExerciseOptionItemViewModel *viewModel; @property (weak, nonatomic) IBOutlet UILabel *optionLabel; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *labelHeight; @end @implementation NYExerciseOptionCell #pragma mark - PublicMethods + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *ID = @"NYExerciseOptionCell"; NYExerciseOptionCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (!cell) { cell = [self rq_viewFromXib]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } return cell; } - (void)bindViewModel:(RQExerciseOptionItemViewModel *)viewModel { @weakify(self) _viewModel = viewModel; RAC(self.optionLabel, attributedText) = [[RACObserve(viewModel, optsString) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; RAC(self.labelHeight, constant) = [[RACObserve(viewModel, labelHeight) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; } #pragma mark - SystemMethods - (void)awakeFromNib { [super awakeFromNib]; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; } @end