RQHomePageOneOrFourSmallCell.m 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // RQHomePageOneOrFourSmallCell.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/6/10.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQHomePageOneOrFourSmallCell.h"
  9. @interface RQHomePageOneOrFourSmallCell ()
  10. @property (nonatomic, readwrite, strong) RQHomePageOneOrFourSmallItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UIView *myContentView;
  12. @property (weak, nonatomic) IBOutlet UIButton *simulationBtn;
  13. @property (weak, nonatomic) IBOutlet UILabel *myTitleLabel;
  14. @property (weak, nonatomic) IBOutlet YYAnimatedImageView *myIconImageView;
  15. @end
  16. @implementation RQHomePageOneOrFourSmallCell
  17. #pragma mark - PublicMethods
  18. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  19. static NSString *ID = @"RQHomePageOneOrFourSmallCell";
  20. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  21. RQHomePageOneOrFourSmallCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  22. if (!cell) cell = [self rq_viewFromXib];
  23. cell.simulationBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(13.f) / 2.f;
  24. return cell;
  25. }
  26. - (void)bindViewModel:(RQHomePageOneOrFourSmallItemViewModel *)viewModel {
  27. _viewModel = viewModel;
  28. _simulationBtn.hidden = ![viewModel.title isEqualToString:@"真实考场"];
  29. _myTitleLabel.text = viewModel.title;
  30. _myIconImageView.image = RQImageNamed(viewModel.icon);
  31. self.myContentView.backgroundColor = viewModel.isLeft? [UIColor qmui_colorWithHexString:@"#E0F8F1"] : [UIColor qmui_colorWithHexString:@"#E8F2FD"];
  32. }
  33. #pragma mark - SystemMethods
  34. - (void)awakeFromNib {
  35. [super awakeFromNib];
  36. // Initialization code
  37. }
  38. @end