RQExerciseSettingCell.m 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // RQExerciseSettingCell.m
  3. // JSJP
  4. //
  5. // Created by RONGQING on 2022/1/17.
  6. //
  7. #import "RQExerciseSettingCell.h"
  8. @interface RQExerciseSettingCell ()
  9. @property (nonatomic, readwrite, strong) RQExerciseSettingItemViewModel *viewModel;
  10. @property (weak, nonatomic) IBOutlet UILabel *myTitleLabel;
  11. @property (weak, nonatomic) IBOutlet UIButton *normalBtn;
  12. @property (weak, nonatomic) IBOutlet UIButton *medimBtn;
  13. @property (weak, nonatomic) IBOutlet UIButton *bigBtn;
  14. @end
  15. @implementation RQExerciseSettingCell
  16. #pragma mark - PublicMethods
  17. + (instancetype)cellWithTableView:(UITableView *)tableView {
  18. static NSString *ID = @"RQExerciseSettingCell";
  19. RQExerciseSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  20. if (!cell) {
  21. cell = [self rq_viewFromXib];
  22. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  23. }
  24. return cell;
  25. }
  26. - (void)bindViewModel:(RQExerciseSettingItemViewModel *)viewModel {
  27. _viewModel = viewModel;
  28. _myTitleLabel.text= _viewModel.title;
  29. NSInteger currentFontSize = RQ_Exercise_Module.exerciseFontSize;
  30. switch (currentFontSize) {
  31. case 19: {
  32. _normalBtn.selected = NO;
  33. _medimBtn.selected = YES;
  34. _bigBtn.selected = NO;
  35. break;
  36. }
  37. case 21: {
  38. _normalBtn.selected = NO;
  39. _medimBtn.selected = NO;
  40. _bigBtn.selected = YES;
  41. break;
  42. }
  43. default: {
  44. _normalBtn.selected = YES;
  45. _medimBtn.selected = NO;
  46. _bigBtn.selected = NO;
  47. break;
  48. }
  49. }
  50. }
  51. #pragma mark - SystemMethods
  52. - (void)awakeFromNib {
  53. [super awakeFromNib];
  54. // Initialization code
  55. }
  56. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  57. [super setSelected:selected animated:animated];
  58. // Configure the view for the selected state
  59. }
  60. #pragma mark - Action
  61. - (IBAction)normalBtnAction:(id)sender {
  62. _normalBtn.selected = YES;
  63. _medimBtn.selected = NO;
  64. _bigBtn.selected = NO;
  65. RQ_Exercise_Module.exerciseFontSize = 17;
  66. }
  67. - (IBAction)medimBtnAction:(id)sender {
  68. _normalBtn.selected = NO;
  69. _medimBtn.selected = YES;
  70. _bigBtn.selected = NO;
  71. RQ_Exercise_Module.exerciseFontSize = 19;
  72. }
  73. - (IBAction)bigBtnAction:(id)sender {
  74. _normalBtn.selected = NO;
  75. _medimBtn.selected = NO;
  76. _bigBtn.selected = YES;
  77. RQ_Exercise_Module.exerciseFontSize = 21;
  78. }
  79. @end