RQHomeSubPageVideoHeaderCollectionReusableView.m 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // RQHomeSubPageVideoHeaderCollectionReusableView.m
  3. // JSJP
  4. //
  5. // Created by 张嵘 on 2021/11/10.
  6. //
  7. #import "RQHomeSubPageVideoHeaderCollectionReusableView.h"
  8. @interface RQHomeSubPageVideoHeaderCollectionReusableView ()
  9. @property (nonatomic, readwrite, strong) RQHomeSubPageVideoHeaderGroupViewModel *viewModel;
  10. @property (weak, nonatomic) IBOutlet UIView *myContentView;
  11. @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
  12. @property (weak, nonatomic) IBOutlet UILabel *moreLabel;
  13. @property (weak, nonatomic) IBOutlet UIImageView *rightArrow;
  14. @end
  15. @implementation RQHomeSubPageVideoHeaderCollectionReusableView
  16. + (instancetype)reusableViewWithCollectionView:(UICollectionView *)collectionView OfKind:(NSString *)elementKind forIndexPath:(NSIndexPath *)indexPath {
  17. NSString *ID = [NSString stringWithFormat:@"%@%@", @"RQHomeSubPageVideoHeaderCollectionReusableView",elementKind];
  18. [collectionView registerNib:[UINib nibWithNibName:@"RQHomeSubPageVideoHeaderCollectionReusableView" bundle:nil] forSupplementaryViewOfKind:elementKind withReuseIdentifier:ID];
  19. RQHomeSubPageVideoHeaderCollectionReusableView *reusableView = [collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:ID forIndexPath:indexPath];
  20. if (!reusableView) reusableView = [self rq_viewFromXib];
  21. return reusableView;
  22. }
  23. - (void)bindViewModel:(RQHomeSubPageVideoHeaderGroupViewModel *)viewModel {
  24. self.viewModel = viewModel;
  25. self.titleLabel.text = viewModel.header;
  26. _moreLabel.hidden = RQStringIsEmpty(viewModel.header) || [viewModel.header isEqualToString:@"短视频"];
  27. _rightArrow.hidden = RQStringIsEmpty(viewModel.header) || [viewModel.header isEqualToString:@"短视频"];
  28. [_myContentView setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
  29. RQVideoCatalogueViewModel *videoCatalogueViewModel = [[RQVideoCatalogueViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  30. RQViewModelUtilKey : self.viewModel.treeListModel,
  31. RQHomePageSubjectTypeKey : @(self.viewModel.homePageSubjectType),
  32. RQVideoItemIndexPathKey : @(self.viewModel.mySection),
  33. }];
  34. [RQ_APPDELEGATE.services pushViewModel:videoCatalogueViewModel animated:YES];
  35. }];
  36. }
  37. - (void)awakeFromNib {
  38. [super awakeFromNib];
  39. // Initialization code
  40. }
  41. @end