mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-07 05:02:56 +00:00
Merge pull request #1791 from colinmcardell/ASCollectionDataController_supplementaryNodeOfKind-fix
[ASCollectionDataController] Exposing -supplementaryNodeOfKind
This commit is contained in:
commit
b1626b0f69
@ -278,9 +278,20 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*
|
||||
* @param indexPath The index path of the requested node.
|
||||
*
|
||||
* @returns a node for display at this indexpath.
|
||||
* @returns a node for display at this indexpath or nil
|
||||
*/
|
||||
- (ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath;
|
||||
- (nullable ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath;
|
||||
|
||||
|
||||
/**
|
||||
* Similar to -supplementaryViewForElementKind:atIndexPath:
|
||||
*
|
||||
* @param elementKind The kind of supplementary node to locate.
|
||||
* @param indexPath The index path of the requested supplementary node.
|
||||
*
|
||||
* @returns The specified supplementary node or nil
|
||||
*/
|
||||
- (nullable ASCellNode *)supplementaryNodeForElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath;
|
||||
|
||||
/**
|
||||
* Similar to -indexPathForCell:.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -257,8 +257,7 @@
|
||||
return nodesOfKindInSection[itemIndex];
|
||||
}
|
||||
}
|
||||
ASDisplayNodeAssert(NO, @"Supplementary node should exist. Kind = %@, indexPath = %@, collectionDataSource = %@", kind, indexPath, self.collectionDataSource);
|
||||
return [[ASCellNode alloc] init];
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Private Helpers
|
||||
|
Loading…
x
Reference in New Issue
Block a user