1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- //
- // RQHomeSubPageViewController.m
- // XinShouJiaDao
- //
- // Created by 张嵘 on 2021/7/8.
- // Copyright © 2021 JCZ. All rights reserved.
- //
- #import "RQHomeSubPageViewController.h"
- @interface RQHomeSubPageViewController () <UITableViewDataSource, UITableViewDelegate>
- /// viewModel
- @property (nonatomic, readonly, strong) RQHomeSubPageViewModel *viewModel;
- @property (nonatomic, readwrite, copy) void(^scrollCallback)(UIScrollView *scrollView);
- @end
- @implementation RQHomeSubPageViewController
- @dynamic viewModel;
- #pragma mark - SystemMethod
- - (void)viewDidLoad {
- [super viewDidLoad];
- /// 初始化
- [self rq_setup];
- }
- #pragma mark - PrivateMethods
- /// 初始化
- - (void)rq_setup {
- /// set up ...
- self.tableView.rowHeight = UITableViewAutomaticDimension;
- self.tableView.backgroundColor = UIColor.clearColor;
- }
- #pragma mark - OverrideMethods
- /// 配置tableView的区域
- - (UIEdgeInsets)contentInset {
- return UIEdgeInsetsMake(0, 0, 0, 0);
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
- RQHomeSubPageCell *cell = [RQHomeSubPageCell cellWithTableView:tableView];
- return cell;
- }
- - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
- RQHomeSubPageCell *homeSubPageCell = (RQHomeSubPageCell *)cell;
- [homeSubPageCell bindViewModel:object];
- }
- #pragma mark - UITableViewDelegate & UITableViewDataSource
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
- !self.scrollCallback ?: self.scrollCallback(scrollView);
- }
- #pragma mark - JXPagingViewListViewDelegate
- - (UIView *)listView {
- return self.view;
- }
- - (UIScrollView *)listScrollView {
- return self.tableView;
- }
- - (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
- self.scrollCallback = callback;
- }
- - (void)listWillAppear {
- NSLog(@"%@:%@", self.title, NSStringFromSelector(_cmd));
- }
- - (void)listDidAppear {
- NSLog(@"%@:%@", self.title, NSStringFromSelector(_cmd));
- }
- - (void)listWillDisappear {
- NSLog(@"%@:%@", self.title, NSStringFromSelector(_cmd));
- }
- - (void)listDidDisappear {
- NSLog(@"%@:%@", self.title, NSStringFromSelector(_cmd));
- }
- @end
|