RQExerciseQuestionCell.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // RQExerciseQuestionCell.m
  3. // SDJK
  4. //
  5. // Created by 张嵘 on 2021/8/16.
  6. //
  7. #import "RQExerciseQuestionCell.h"
  8. @interface RQExerciseQuestionCell ()
  9. @property (nonatomic, readwrite, strong) RQExerciseQuestionItemViewModel *viewModel;
  10. @property (weak, nonatomic) IBOutlet UILabel *typeLabel;
  11. @property (weak, nonatomic) IBOutlet UILabel *questionLabel;
  12. @property (weak, nonatomic) IBOutlet UIImageView *questionImageView;
  13. @end
  14. @implementation RQExerciseQuestionCell
  15. #pragma mark - PublicMethods
  16. + (instancetype)cellWithTableView:(UITableView *)tableView {
  17. static NSString *ID = @"RQExerciseQuestionCell";
  18. RQExerciseQuestionCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  19. if (!cell) {
  20. cell = [self rq_viewFromXib];
  21. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  22. [cell.typeLabel jm_setJMRadius:JMRadiusMake(10, 0, 10, 10) withBackgroundColor:RQ_MAIN_COLOR];
  23. }
  24. return cell;
  25. }
  26. - (void)bindViewModel:(RQExerciseQuestionItemViewModel *)viewModel {
  27. _viewModel = viewModel;
  28. self.typeLabel.text = viewModel.typeString;
  29. self.questionLabel.attributedText = viewModel.qusetionString;
  30. self.questionImageView.hidden = RQStringIsEmpty(viewModel.imageString);
  31. [self.questionImageView yy_setImageWithURL:[NSURL URLWithString:viewModel.imageString] placeholder:RQWebImagePlaceholder()];
  32. }
  33. #pragma mark - SystemMethods
  34. - (void)awakeFromNib {
  35. [super awakeFromNib];
  36. // Initialization code
  37. }
  38. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  39. [super setSelected:selected animated:animated];
  40. // Configure the view for the selected state
  41. }
  42. @end