Fix Issues Repopulating Supplementary Elements (#3098)

* Fix issues repopulating supplementary elements

* Remove unrelated change

* Update comments
This commit is contained in:
Adlai Holler
2017-02-27 16:06:06 -08:00
committed by GitHub
parent 774f3ffa9e
commit 25bc97c5c8
3 changed files with 46 additions and 33 deletions

View File

@@ -63,18 +63,19 @@ typedef NSMutableDictionary<NSString *, NSMutableDictionary<NSIndexPath *, ASCol
- (void)removeAllElements
{
[_sectionsOfItems removeAllObjects];
[_supplementaryElements removeAllObjects];
}
- (void)removeElementsOfKind:(NSString *)kind inSections:(NSIndexSet *)sections
- (void)removeSectionsOfItems:(NSIndexSet *)itemSections
{
if ([kind isEqualToString:ASDataControllerRowNodeKind]) {
// Items
[_sectionsOfItems removeObjectsAtIndexes:sections];
} else {
// Supplementaries
NSMutableDictionary *supplementariesForKind = _supplementaryElements[kind];
[_sectionsOfItems removeObjectsAtIndexes:itemSections];
}
- (void)removeSupplementaryElementsInSections:(NSIndexSet *)sections
{
[_supplementaryElements enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSMutableDictionary<NSIndexPath *,ASCollectionElement *> * _Nonnull supplementariesForKind, BOOL * _Nonnull stop) {
[supplementariesForKind removeObjectsForKeys:[sections as_filterIndexPathsBySection:supplementariesForKind]];
}
}];
}
- (void)insertEmptySectionsOfItemsAtIndexes:(NSIndexSet *)sections