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

让jxPageView支持多组数据展示

parent 8254db69
......@@ -163,6 +163,7 @@
- (void)preferredProcessListViewDidScroll:(UIScrollView *)scrollView;
- (void)preferredProcessMainTableViewDidScroll:(UIScrollView *)scrollView;
// 获取listContainer的Cell
- (UITableViewCell *)listContainerCellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CGFloat)listContainerCellHeight;
......
......@@ -43,7 +43,6 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier";
self.mainTableView.dataSource = self;
self.mainTableView.delegate = self;
[self refreshTableHeaderView];
[self.mainTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
[self.mainTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kGM_ListCellIdentifier];
if (@available(iOS 11.0, *)) {
self.mainTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
......@@ -70,7 +69,7 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier";
- (void)reloadData {
self.currentList = nil;
self.currentScrollingListView = nil;
self.listContainerCell = nil;
for (id<JXPagerViewListViewDelegate> list in self.validListDict.allValues) {
[list.listView removeFromSuperview];
}
......@@ -139,14 +138,17 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier";
- (UITableViewCell *)listContainerCellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [self.mainTableView dequeueReusableCellWithIdentifier:kGM_ListCellIdentifier forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
self.listContainerCell = cell;
for (UIView *view in cell.contentView.subviews) {
[view removeFromSuperview];
UITableViewCell *cell = self.listContainerCell;
if (!cell) {
cell = [self.mainTableView dequeueReusableCellWithIdentifier:kGM_ListCellIdentifier forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
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;
}
......@@ -169,13 +171,8 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier";
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
for (UIView *view in cell.contentView.subviews) {
[view removeFromSuperview];
}
self.listContainerView.frame = cell.contentView.bounds;
[cell.contentView addSubview:self.listContainerView];
return cell;
return [self listContainerCellForRowAtIndexPath:indexPath];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
......@@ -195,7 +192,7 @@ static NSString *const kGM_ListCellIdentifier = @"gm_ListCellIdentifier";
footer.backgroundColor = [UIColor clearColor];
return footer;
}
#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
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