RQHomePageSimulationExamCell.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // RQHomePageSimulationExamCell.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/6/10.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQHomePageSimulationExamCell.h"
  9. @interface RQHomePageSimulationExamCell ()
  10. @property (nonatomic, readwrite, strong) RQHomePageSimulationExamItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UIButton *oneBtn;
  12. @property (weak, nonatomic) IBOutlet UIButton *twoBtn;
  13. @property (weak, nonatomic) IBOutlet UIButton *tryBtn;
  14. @property (weak, nonatomic) IBOutlet UILabel *myTitleLabel;
  15. @end
  16. @implementation RQHomePageSimulationExamCell
  17. #pragma mark - PublicMethods
  18. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  19. static NSString *ID = @"RQHomePageSimulationExamCell";
  20. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  21. RQHomePageSimulationExamCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  22. if (!cell) cell = [self rq_viewFromXib];
  23. cell.oneBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(16.f) / 2.f;
  24. cell.twoBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(16.f) / 2.f;
  25. [cell.tryBtn setBackgroundImage:[UIImage imageWithGradualChangingColor:^(QQGradualChangingColor *graColor) {
  26. graColor.fromColor = [UIColor qmui_colorWithHexString:@"#498EF5"];
  27. graColor.toColor = [UIColor qmui_colorWithHexString:@"#4DA8E6"];
  28. graColor.type = QQGradualChangeTypeLeftToRight;
  29. } size:cell.tryBtn.size cornerRadius:QQRadiusMakeSame(RQ_FIT_HORIZONTAL(30.f) / 2.f)] forState:UIControlStateNormal];
  30. cell.tryBtn.layer.shadowColor = [UIColor qmui_colorWithHexString:@"#498EF5"].CGColor;
  31. return cell;
  32. }
  33. - (void)bindViewModel:(RQHomePageSimulationExamItemViewModel *)viewModel {
  34. _viewModel = viewModel;
  35. _myTitleLabel.text = (self.viewModel.homePageSubjectType == RQHomePageSubjectType_SubjectOne)? @"科一真实考场模拟" : @"科四真实考场模拟";
  36. }
  37. #pragma mark - SystemMethods
  38. - (void)awakeFromNib {
  39. [super awakeFromNib];
  40. // Initialization code
  41. }
  42. @end