From d77df45bfd55ad79d8ecd15b625974ac660c51e6 Mon Sep 17 00:00:00 2001 From: Levi McCallum Date: Tue, 6 Oct 2015 12:03:16 -0700 Subject: [PATCH] Delete supplementary nodes when section is deleted --- AsyncDisplayKit/Details/ASCollectionDataController.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AsyncDisplayKit/Details/ASCollectionDataController.mm b/AsyncDisplayKit/Details/ASCollectionDataController.mm index 98d4fb4895..7eee33fffe 100644 --- a/AsyncDisplayKit/Details/ASCollectionDataController.mm +++ b/AsyncDisplayKit/Details/ASCollectionDataController.mm @@ -103,6 +103,17 @@ } - (void)willDeleteSections:(NSIndexSet *)sections +{ + NSArray *elementKinds = [self.collectionDataSource supplementaryNodeKindsInDataController:self]; + [elementKinds enumerateObjectsUsingBlock:^(NSString *kind, NSUInteger idx, BOOL *stop) { + NSArray *indexPaths = ASIndexPathsForMultidimensionalArrayAtIndexSet([self editingNodesOfKind:kind], sections); + + [self deleteNodesOfKind:kind atIndexPaths:indexPaths completion:nil]; + [self deleteSectionsOfKind:kind atIndexSet:sections completion:nil]; + }]; +} + +- (void)prepareForReloadSections:(NSIndexSet *)sections { // TODO: Implement }