Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 5745cfd

Browse files
author
Scott Goodson
committed
Enable node detection for tableHeaderView and tableFooterView on ASTableView.
Ensure they behave as managed nodes - which prevents them from clearContents-ing their subnodes when the table reloads, as they will be onscreen as long as the table is.
1 parent 16b0bd9 commit 5745cfd

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

AsyncDisplayKit/ASTableView.mm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,22 @@ - (void)adjustContentOffsetWithNodes:(NSArray *)nodes atIndexPaths:(NSArray *)in
532532
#pragma mark -
533533
#pragma mark Intercepted selectors
534534

535+
- (void)setTableHeaderView:(UIView *)tableHeaderView
536+
{
537+
// Typically the view will be nil before setting it, but reset state if it is being re-hosted.
538+
[self.tableHeaderView.asyncdisplaykit_node exitHierarchyState:ASHierarchyStateRangeManaged];
539+
[super setTableHeaderView:tableHeaderView];
540+
[self.tableHeaderView.asyncdisplaykit_node enterHierarchyState:ASHierarchyStateRangeManaged];
541+
}
542+
543+
- (void)setTableFooterView:(UIView *)tableFooterView
544+
{
545+
// Typically the view will be nil before setting it, but reset state if it is being re-hosted.
546+
[self.tableFooterView.asyncdisplaykit_node exitHierarchyState:ASHierarchyStateRangeManaged];
547+
[super setTableFooterView:tableFooterView];
548+
[self.tableFooterView.asyncdisplaykit_node enterHierarchyState:ASHierarchyStateRangeManaged];
549+
}
550+
535551
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
536552
{
537553
_ASTableViewCell *cell = [self dequeueReusableCellWithIdentifier:kCellReuseIdentifier forIndexPath:indexPath];

0 commit comments

Comments
 (0)