RQHomeSubPageViewController.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // RQHomeSubPageViewController.m
  3. // XinShouJiaDao
  4. //
  5. // Created by 张嵘 on 2021/7/8.
  6. // Copyright © 2021 JCZ. All rights reserved.
  7. //
  8. #import "RQHomeSubPageViewController.h"
  9. @interface RQHomeSubPageViewController () <UITableViewDataSource, UITableViewDelegate>
  10. /// viewModel
  11. @property (nonatomic, readonly, strong) RQHomeSubPageViewModel *viewModel;
  12. @property (nonatomic, readwrite, copy) void(^scrollCallback)(UIScrollView *scrollView);
  13. @end
  14. @implementation RQHomeSubPageViewController
  15. @dynamic viewModel;
  16. #pragma mark - SystemMethod
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. /// 初始化
  20. [self rq_setup];
  21. }
  22. #pragma mark - PrivateMethods
  23. /// 初始化
  24. - (void)rq_setup {
  25. /// set up ...
  26. self.tableView.rowHeight = UITableViewAutomaticDimension;
  27. self.tableView.backgroundColor = UIColor.clearColor;
  28. }
  29. #pragma mark - OverrideMethods
  30. /// 配置tableView的区域
  31. - (UIEdgeInsets)contentInset {
  32. return UIEdgeInsetsMake(0, 0, 0, 0);
  33. }
  34. - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  35. RQHomeSubPageCell *cell = [RQHomeSubPageCell cellWithTableView:tableView];
  36. return cell;
  37. }
  38. - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  39. RQHomeSubPageCell *homeSubPageCell = (RQHomeSubPageCell *)cell;
  40. [homeSubPageCell bindViewModel:object];
  41. }
  42. #pragma mark - UITableViewDelegate & UITableViewDataSource
  43. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  44. !self.scrollCallback ?: self.scrollCallback(scrollView);
  45. }
  46. #pragma mark - JXPagingViewListViewDelegate
  47. - (UIView *)listView {
  48. return self.view;
  49. }
  50. - (UIScrollView *)listScrollView {
  51. return self.tableView;
  52. }
  53. - (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
  54. self.scrollCallback = callback;
  55. }
  56. - (void)listWillAppear {
  57. NSLog(@"%@:%@", self.title, NSStringFromSelector(_cmd));
  58. }
  59. - (void)listDidAppear {
  60. NSLog(@"%@:%@", self.title, NSStringFromSelector(_cmd));
  61. }
  62. - (void)listWillDisappear {
  63. NSLog(@"%@:%@", self.title, NSStringFromSelector(_cmd));
  64. }
  65. - (void)listDidDisappear {
  66. NSLog(@"%@:%@", self.title, NSStringFromSelector(_cmd));
  67. }
  68. @end