RQLearningMaterialsListCell.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // RQLearningMaterialsListCell.m
  3. // SDJK
  4. //
  5. // Created by 张嵘 on 2022/6/30.
  6. //
  7. #import "RQLearningMaterialsListCell.h"
  8. @interface RQLearningMaterialsListCell ()
  9. @property (nonatomic, readwrite, strong) RQLearningMaterialsItemViewModel *viewModel;
  10. @property (weak, nonatomic) IBOutlet UILabel *myTitleLabel;
  11. @property (weak, nonatomic) IBOutlet QMUIButton *studyBtn;
  12. @property (weak, nonatomic) IBOutlet UIButton *iconAndTextBtn;
  13. @end
  14. @implementation RQLearningMaterialsListCell
  15. #pragma mark - PublicMethods
  16. + (instancetype)cellWithTableView:(UITableView *)tableView {
  17. static NSString *ID = @"RQLearningMaterialsListCell";
  18. RQLearningMaterialsListCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  19. if (!cell) {
  20. cell = [self rq_viewFromXib];
  21. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  22. [cell.studyBtn setBackgroundImage:[UIImage imageWithQQCorner:^(QQCorner *corner) {
  23. corner.borderColor = RQ_MAIN_COLOR;
  24. corner.borderWidth = 1;
  25. corner.fillColor = UIColor.whiteColor;
  26. corner.radius = QQRadiusMakeSame(RQ_FIT_HORIZONTAL(24.f) / 2.f);
  27. } size:CGSizeMake(RQ_FIT_HORIZONTAL(72.f), RQ_FIT_HORIZONTAL(24.f))] forState:UIControlStateNormal];
  28. [cell.iconAndTextBtn setBackgroundImage:[UIImage imageWithQQCorner:^(QQCorner *corner) {
  29. corner.borderColor = RQ_MAIN_TEXT_COLOR_2;
  30. corner.borderWidth = 1;
  31. corner.fillColor = UIColor.whiteColor;
  32. corner.radius = QQRadiusMakeSame(3.f);
  33. } size:CGSizeMake(RQ_FIT_HORIZONTAL(30.f), RQ_FIT_HORIZONTAL(16.f))] forState:UIControlStateNormal];
  34. }
  35. return cell;
  36. }
  37. - (void)bindViewModel:(RQLearningMaterialsItemViewModel *)viewModel {
  38. _viewModel = viewModel;
  39. self.myTitleLabel.text = viewModel.title;
  40. }
  41. #pragma mark - SystemMethods
  42. - (void)awakeFromNib {
  43. [super awakeFromNib];
  44. // Initialization code
  45. }
  46. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  47. [super setSelected:selected animated:animated];
  48. // Configure the view for the selected state
  49. }
  50. @end