123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //
- // 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) {
- // 获取当前系统版本
- NSOperatingSystemVersion systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
- if (systemVersion.majorVersion < 18.0) {
- NSLog(@"当前系统版本小于 iOS 18.0");
- 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];
- } else {
- NSLog(@"当前系统版本大于 iOS 18.0");
- NYVideoCatalogueViewModel *videoCatalogueViewModel = [[NYVideoCatalogueViewModel 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
|