// // RQExerciseSettingCell.m // JSJP // // Created by RONGQING on 2022/1/17. // #import "RQExerciseSettingCell.h" @interface RQExerciseSettingCell () @property (nonatomic, readwrite, strong) RQExerciseSettingItemViewModel *viewModel; @property (weak, nonatomic) IBOutlet UILabel *myTitleLabel; @property (weak, nonatomic) IBOutlet UIButton *normalBtn; @property (weak, nonatomic) IBOutlet UIButton *medimBtn; @property (weak, nonatomic) IBOutlet UIButton *bigBtn; @end @implementation RQExerciseSettingCell #pragma mark - PublicMethods + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *ID = @"RQExerciseSettingCell"; RQExerciseSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (!cell) { cell = [self rq_viewFromXib]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } return cell; } - (void)bindViewModel:(RQExerciseSettingItemViewModel *)viewModel { _viewModel = viewModel; _myTitleLabel.text= _viewModel.title; NSInteger currentFontSize = RQ_Exercise_Module.exerciseFontSize; switch (currentFontSize) { case 19: { _normalBtn.selected = NO; _medimBtn.selected = YES; _bigBtn.selected = NO; break; } case 21: { _normalBtn.selected = NO; _medimBtn.selected = NO; _bigBtn.selected = YES; break; } default: { _normalBtn.selected = YES; _medimBtn.selected = NO; _bigBtn.selected = NO; break; } } } #pragma mark - SystemMethods - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } #pragma mark - Action - (IBAction)normalBtnAction:(id)sender { _normalBtn.selected = YES; _medimBtn.selected = NO; _bigBtn.selected = NO; RQ_Exercise_Module.exerciseFontSize = 17; } - (IBAction)medimBtnAction:(id)sender { _normalBtn.selected = NO; _medimBtn.selected = YES; _bigBtn.selected = NO; RQ_Exercise_Module.exerciseFontSize = 19; } - (IBAction)bigBtnAction:(id)sender { _normalBtn.selected = NO; _medimBtn.selected = NO; _bigBtn.selected = YES; RQ_Exercise_Module.exerciseFontSize = 21; } @end