// // RQExerciseQuestionCell.m // SDJK // // Created by 张嵘 on 2021/8/16. // #import "RQExerciseQuestionCell.h" @interface RQExerciseQuestionCell () @property (nonatomic, readwrite, strong) RQExerciseQuestionItemViewModel *viewModel; @property (weak, nonatomic) IBOutlet UILabel *typeLabel; @property (weak, nonatomic) IBOutlet UILabel *questionLabel; @property (weak, nonatomic) IBOutlet UIImageView *questionImageView; @end @implementation RQExerciseQuestionCell #pragma mark - PublicMethods + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *ID = @"RQExerciseQuestionCell"; RQExerciseQuestionCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (!cell) { cell = [self rq_viewFromXib]; cell.selectionStyle = UITableViewCellSelectionStyleNone; [cell.typeLabel jm_setJMRadius:JMRadiusMake(10, 0, 10, 10) withBackgroundColor:RQ_MAIN_COLOR]; } return cell; } - (void)bindViewModel:(RQExerciseQuestionItemViewModel *)viewModel { _viewModel = viewModel; self.typeLabel.text = viewModel.typeString; self.questionLabel.attributedText = viewModel.qusetionString; self.questionImageView.hidden = RQStringIsEmpty(viewModel.imageString); [self.questionImageView yy_setImageWithURL:[NSURL URLWithString:viewModel.imageString] placeholder:RQWebImagePlaceholder()]; } #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 } @end