Merge pull request #1791 from colinmcardell/ASCollectionDataController_supplementaryNodeOfKind-fix

[ASCollectionDataController] Exposing -supplementaryNodeOfKind
This commit is contained in:
Adlai Holler
2016-07-08 12:50:32 -07:00
committed by GitHub
3 changed files with 20 additions and 4 deletions

View File

@@ -440,6 +440,11 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
return [_dataController nodeAtIndexPath:indexPath];
}
- (ASCellNode *)supplementaryNodeForElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath
{
return [_dataController supplementaryNodeOfKind:elementKind atIndexPath:indexPath];
}
- (NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode
{
return [_dataController indexPathForNode:cellNode];
@@ -592,6 +597,7 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
NSString *identifier = [self __reuseIdentifierForKind:kind];
UICollectionReusableView *view = [self dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:identifier forIndexPath:indexPath];
ASCellNode *node = [_dataController supplementaryNodeOfKind:kind atIndexPath:indexPath];
ASDisplayNodeAssert(node != nil, @"Supplementary node should exist. Kind = %@, indexPath = %@, collectionDataSource = %@", kind, indexPath, self);
[_rangeController configureContentView:view forCellNode:node];
return view;
}