NYLIHomePageVideoExamCell.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // NYLIHomePageVideoExamCell.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2025/2/27.
  6. // Copyright © 2025 JCZ. All rights reserved.
  7. //
  8. #import "NYLIHomePageVideoExamCell.h"
  9. @interface NYLIHomePageVideoExamCell ()
  10. @property (nonatomic, readwrite, strong) NYLIHomePageVideoExamItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UIButton *tryBtn;
  12. @property (weak, nonatomic) IBOutlet UILabel *title_label01;
  13. @property (weak, nonatomic) IBOutlet UILabel *title_label02;
  14. @end
  15. @implementation NYLIHomePageVideoExamCell
  16. #pragma mark - PublicMethods
  17. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  18. static NSString *ID = @"NYLIHomePageVideoExamCell";
  19. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  20. NYLIHomePageVideoExamCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  21. if (!cell) cell = [self rq_viewFromXib];
  22. [cell.tryBtn setBackgroundImage:[UIImage imageWithGradualChangingColor:^(QQGradualChangingColor *graColor) {
  23. graColor.fromColor = [UIColor qmui_colorWithHexString:@"#FF4D53"];
  24. graColor.toColor = [UIColor qmui_colorWithHexString:@"#FF776D"];
  25. graColor.type = QQGradualChangeTypeLeftToRight;
  26. } size:cell.tryBtn.size cornerRadius:QQRadiusMakeSame(RQ_FIT_HORIZONTAL(30.f) / 2.f)] forState:UIControlStateNormal];
  27. cell.tryBtn.layer.shadowColor = [UIColor qmui_colorWithHexString:@"#FF4D53"].CGColor;
  28. return cell;
  29. }
  30. - (void)bindViewModel:(NYLIHomePageVideoExamItemViewModel *)viewModel {
  31. _viewModel = viewModel;
  32. _title_label01.text = (self.viewModel.homePageSubjectType == RQHomePageSubjectType_SubjectOne)? @"科一精选500" : @"科四精选300";
  33. }
  34. #pragma mark - SystemMethods
  35. - (void)awakeFromNib {
  36. [super awakeFromNib];
  37. // Initialization code
  38. }
  39. @end