// // RQHomeSubPageVideoHeaderCollectionReusableView.m // JSJP // // Created by 张嵘 on 2021/11/10. // #import "RQHomeSubPageVideoHeaderCollectionReusableView.h" @interface RQHomeSubPageVideoHeaderCollectionReusableView () @property (nonatomic, readwrite, strong) RQHomeSubPageVideoHeaderGroupViewModel *viewModel; @property (weak, nonatomic) IBOutlet UIView *myContentView; @property (weak, nonatomic) IBOutlet UILabel *titleLabel; @property (weak, nonatomic) IBOutlet UILabel *moreLabel; @property (weak, nonatomic) IBOutlet UIImageView *rightArrow; @end @implementation RQHomeSubPageVideoHeaderCollectionReusableView + (instancetype)reusableViewWithCollectionView:(UICollectionView *)collectionView OfKind:(NSString *)elementKind forIndexPath:(NSIndexPath *)indexPath { NSString *ID = [NSString stringWithFormat:@"%@%@", @"RQHomeSubPageVideoHeaderCollectionReusableView",elementKind]; [collectionView registerNib:[UINib nibWithNibName:@"RQHomeSubPageVideoHeaderCollectionReusableView" bundle:nil] forSupplementaryViewOfKind:elementKind withReuseIdentifier:ID]; RQHomeSubPageVideoHeaderCollectionReusableView *reusableView = [collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:ID forIndexPath:indexPath]; if (!reusableView) reusableView = [self rq_viewFromXib]; return reusableView; } - (void)bindViewModel:(RQHomeSubPageVideoHeaderGroupViewModel *)viewModel { self.viewModel = viewModel; self.titleLabel.text = viewModel.header; _moreLabel.hidden = RQStringIsEmpty(viewModel.header) || [viewModel.header isEqualToString:@"短视频"]; _rightArrow.hidden = RQStringIsEmpty(viewModel.header) || [viewModel.header isEqualToString:@"短视频"]; [_myContentView setTapActionWithBlock:^(UITapGestureRecognizer *tap) { RQVideoCatalogueViewModel *videoCatalogueViewModel = [[RQVideoCatalogueViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{ RQViewModelUtilKey : self.viewModel.treeListModel, RQHomePageSubjectTypeKey : @(self.viewModel.homePageSubjectType), RQVideoItemIndexPathKey : @(self.viewModel.mySection), }]; [RQ_APPDELEGATE.services pushViewModel:videoCatalogueViewModel animated:YES]; }]; } - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } @end