RQHomeSubPageVideoHeaderCollectionReusableView.m 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // RQHomeSubPageVideoHeaderCollectionReusableView.m
  3. // SDJK
  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 UIStackView *moreView;
  13. @end
  14. @implementation RQHomeSubPageVideoHeaderCollectionReusableView
  15. + (instancetype)reusableViewWithCollectionView:(UICollectionView *)collectionView OfKind:(NSString *)elementKind forIndexPath:(NSIndexPath *)indexPath {
  16. NSString *ID = [NSString stringWithFormat:@"%@%@", @"RQHomeSubPageVideoHeaderCollectionReusableView",elementKind];
  17. [collectionView registerNib:[UINib nibWithNibName:@"RQHomeSubPageVideoHeaderCollectionReusableView" bundle:nil] forSupplementaryViewOfKind:elementKind withReuseIdentifier:ID];
  18. RQHomeSubPageVideoHeaderCollectionReusableView *reusableView = [collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:ID forIndexPath:indexPath];
  19. if (!reusableView) reusableView = [self rq_viewFromXib];
  20. return reusableView;
  21. }
  22. - (void)bindViewModel:(RQHomeSubPageVideoHeaderGroupViewModel *)viewModel {
  23. self.viewModel = viewModel;
  24. self.titleLabel.text = viewModel.groupModel.header;
  25. _moreView.hidden = [viewModel.groupModel.header isEqualToString:@"短视频"] || RQStringIsEmpty(viewModel.groupModel.header);
  26. _myContentView.userInteractionEnabled = !_moreView.hidden;
  27. [_myContentView setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
  28. RQVideoCatalogueViewModel *videoCatalogueViewModel = [[RQVideoCatalogueViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  29. RQViewModelUtilKey : self.viewModel.treeListModel,
  30. RQHomePageSubjectTypeKey : @(self.viewModel.homePageSubjectType),
  31. RQVideoItemIndexPathKey : @(self.viewModel.mySection),
  32. }];
  33. [RQ_APPDELEGATE.services pushViewModel:videoCatalogueViewModel animated:YES];
  34. }];
  35. }
  36. - (void)awakeFromNib {
  37. [super awakeFromNib];
  38. // Initialization code
  39. }
  40. @end