// // RQVipCenterSubListViewController.m // jiaPei // // Created by 张嵘 on 2022/9/22. // Copyright © 2022 JCZ. All rights reserved. // #import "RQVipCenterSubListViewController.h" @interface RQVipCenterSubListViewController () /// viewModel @property (nonatomic, readonly, strong) RQVipCenterSubListViewModel *viewModel; @end @implementation RQVipCenterSubListViewController @dynamic viewModel; #pragma mark - SystemMethod - (void)viewDidLoad { [super viewDidLoad]; /// 初始化 [self rq_setup]; } - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; self.collectionView.frame = CGRectMake(0, 0, RQ_SCREEN_WIDTH, RQ_SCREEN_HEIGHT - (RQ_APPLICATION_NAV_BAR_HEIGHT + RQ_APPLICATION_STATUS_BAR_HEIGHT + 0.f + RQ_FIT_HORIZONTAL(108.f) + 32.f + RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT)); } #pragma mark - PrivateMethods /// 初始化 - (void)rq_setup { /// set up ... self.collectionView.bounces = NO; self.collectionView.backgroundColor = UIColor.clearColor; } #pragma mark - OverrideMethods /// 配置collectionView的区域 - (UIEdgeInsets)contentInset { return UIEdgeInsetsMake(0, 0, 0, 0); } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath { RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section]; RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row]; return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath]; } - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object { [cell bindViewModel:object]; } #pragma mark - UITableViewDelegate & UITableViewDataSource - (void)scrollViewDidScroll:(UIScrollView *)scrollView { !self.scrollCallback ?: self.scrollCallback(scrollView); } #pragma mark - JXPagerViewListViewDelegate - (UIView *)listView { return self.view; } - (UIScrollView *)listScrollView { return self.collectionView; } - (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback { self.scrollCallback = callback; } @end