Commit aa147bcc authored by 艾娇平's avatar 艾娇平

让jxPageView支持多组数据展示

parent 8254db69
...@@ -163,6 +163,7 @@ ...@@ -163,6 +163,7 @@
- (void)preferredProcessListViewDidScroll:(UIScrollView *)scrollView; - (void)preferredProcessListViewDidScroll:(UIScrollView *)scrollView;
- (void)preferredProcessMainTableViewDidScroll:(UIScrollView *)scrollView; - (void)preferredProcessMainTableViewDidScroll:(UIScrollView *)scrollView;
// 获取listContainer的Cell
- (UITableViewCell *)listContainerCellForRowAtIndexPath:(NSIndexPath *)indexPath; - (UITableViewCell *)listContainerCellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CGFloat)listContainerCellHeight; - (CGFloat)listContainerCellHeight;
......
...@@ -43,7 +43,6 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier"; ...@@ -43,7 +43,6 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier";
self.mainTableView.dataSource = self; self.mainTableView.dataSource = self;
self.mainTableView.delegate = self; self.mainTableView.delegate = self;
[self refreshTableHeaderView]; [self refreshTableHeaderView];
[self.mainTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
[self.mainTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kGM_ListCellIdentifier]; [self.mainTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kGM_ListCellIdentifier];
if (@available(iOS 11.0, *)) { if (@available(iOS 11.0, *)) {
self.mainTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; self.mainTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
...@@ -70,7 +69,7 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier"; ...@@ -70,7 +69,7 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier";
- (void)reloadData { - (void)reloadData {
self.currentList = nil; self.currentList = nil;
self.currentScrollingListView = nil; self.currentScrollingListView = nil;
self.listContainerCell = nil;
for (id<JXPagerViewListViewDelegate> list in self.validListDict.allValues) { for (id<JXPagerViewListViewDelegate> list in self.validListDict.allValues) {
[list.listView removeFromSuperview]; [list.listView removeFromSuperview];
} }
...@@ -139,14 +138,17 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier"; ...@@ -139,14 +138,17 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier";
- (UITableViewCell *)listContainerCellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)listContainerCellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [self.mainTableView dequeueReusableCellWithIdentifier:kGM_ListCellIdentifier forIndexPath:indexPath]; UITableViewCell *cell = self.listContainerCell;
cell.selectionStyle = UITableViewCellSelectionStyleNone; if (!cell) {
self.listContainerCell = cell; cell = [self.mainTableView dequeueReusableCellWithIdentifier:kGM_ListCellIdentifier forIndexPath:indexPath];
for (UIView *view in cell.contentView.subviews) { cell.selectionStyle = UITableViewCellSelectionStyleNone;
[view removeFromSuperview]; self.listContainerCell = cell;
for (UIView *view in cell.contentView.subviews) {
[view removeFromSuperview];
}
self.listContainerView.frame = CGRectMake(0, 0, cell.contentView.bounds.size.width, cell.contentView.bounds.size.height);
[cell.contentView addSubview:self.listContainerView];
} }
self.listContainerView.frame = CGRectMake(0, 0, cell.contentView.bounds.size.width, cell.contentView.bounds.size.height - 0);
[cell.contentView addSubview:self.listContainerView];
return cell; return cell;
} }
...@@ -169,13 +171,8 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier"; ...@@ -169,13 +171,8 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier";
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
for (UIView *view in cell.contentView.subviews) { return [self listContainerCellForRowAtIndexPath:indexPath];
[view removeFromSuperview];
}
self.listContainerView.frame = cell.contentView.bounds;
[cell.contentView addSubview:self.listContainerView];
return cell;
} }
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
...@@ -195,7 +192,7 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier"; ...@@ -195,7 +192,7 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier";
footer.backgroundColor = [UIColor clearColor]; footer.backgroundColor = [UIColor clearColor];
return footer; return footer;
} }
#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (self.mainTableView.mj_header.refreshing) { if (self.mainTableView.mj_header.refreshing) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment