123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- //
- // RQHomeSubPageVideoHeaderCollectionReusableView.m
- // SDJK
- //
- // 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 UIStackView *moreView;
- @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.groupModel.header;
- _moreView.hidden = [viewModel.groupModel.header isEqualToString:@"短视频"] || RQStringIsEmpty(viewModel.groupModel.header);
- _myContentView.userInteractionEnabled = !_moreView.hidden;
- [_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
|