RQVipCenterSubListViewController.m 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // RQVipCenterSubListViewController.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/9/22.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQVipCenterSubListViewController.h"
  9. @interface RQVipCenterSubListViewController ()
  10. /// viewModel
  11. @property (nonatomic, readonly, strong) RQVipCenterSubListViewModel *viewModel;
  12. @end
  13. @implementation RQVipCenterSubListViewController
  14. @dynamic viewModel;
  15. #pragma mark - SystemMethod
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. /// 初始化
  19. [self rq_setup];
  20. }
  21. - (void)viewDidLayoutSubviews {
  22. [super viewDidLayoutSubviews];
  23. 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));
  24. }
  25. #pragma mark - PrivateMethods
  26. /// 初始化
  27. - (void)rq_setup {
  28. /// set up ...
  29. self.collectionView.bounces = NO;
  30. self.collectionView.backgroundColor = UIColor.clearColor;
  31. }
  32. #pragma mark - OverrideMethods
  33. /// 配置collectionView的区域
  34. - (UIEdgeInsets)contentInset {
  35. return UIEdgeInsetsMake(0, 0, 0, 0);
  36. }
  37. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  38. RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
  39. RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
  40. return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
  41. }
  42. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  43. [cell bindViewModel:object];
  44. }
  45. #pragma mark - UITableViewDelegate & UITableViewDataSource
  46. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  47. !self.scrollCallback ?: self.scrollCallback(scrollView);
  48. }
  49. #pragma mark - JXPagerViewListViewDelegate
  50. - (UIView *)listView {
  51. return self.view;
  52. }
  53. - (UIScrollView *)listScrollView {
  54. return self.collectionView;
  55. }
  56. - (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
  57. self.scrollCallback = callback;
  58. }
  59. @end