From 8ed5c8f9d1f62096dfd16f28ec8864c53b2c7c97 Mon Sep 17 00:00:00 2001 From: YoloMao Date: Thu, 3 Aug 2023 11:34:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=AF=E6=8C=81=20UITableViewHeaderFo?= =?UTF-8?q?oterView=20=E5=9C=88=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Category/UITableView+GrowingNode.m | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/GrowingAutotrackerCore/GrowingNode/Category/UITableView+GrowingNode.m b/GrowingAutotrackerCore/GrowingNode/Category/UITableView+GrowingNode.m index a34104ba8..965f432ab 100644 --- a/GrowingAutotrackerCore/GrowingNode/Category/UITableView+GrowingNode.m +++ b/GrowingAutotrackerCore/GrowingNode/Category/UITableView+GrowingNode.m @@ -24,9 +24,25 @@ @implementation UITableView (GrowingNode) - (NSArray> *)growingNodeChilds { - // 对于collectionView我们仅需要返回可见cell NSMutableArray *childs = [NSMutableArray array]; [childs addObjectsFromArray:self.visibleCells]; + + NSArray *indexPaths = self.indexPathsForVisibleRows; + NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet]; + for (NSIndexPath *indexPath in indexPaths) { + [indexSet addIndex:indexPath.section]; + } + [indexSet enumerateIndexesUsingBlock:^(NSUInteger section, BOOL * _Nonnull stop) { + UITableViewHeaderFooterView *headerView = [self headerViewForSection:section]; + if (headerView) { + [childs addObject:headerView]; + } + UITableViewHeaderFooterView *footerView = [self footerViewForSection:section]; + if (footerView) { + [childs addObject:footerView]; + } + }]; + if (self.tableFooterView) { [childs addObject:self.tableFooterView]; }