From c42d41fb4c49d9fc5c36aa7120568d1a76d7b68c Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Tue, 11 Nov 2014 19:53:10 +0200 Subject: [PATCH] Provide ASCollectionView::calculatedSizeForNodeAtIndexPath:, to be used in custom UICollectionViewLayouts. --- AsyncDisplayKit/ASCollectionView.h | 7 +++++++ AsyncDisplayKit/ASCollectionView.m | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/AsyncDisplayKit/ASCollectionView.h b/AsyncDisplayKit/ASCollectionView.h index 6314da2604..abf25ec809 100644 --- a/AsyncDisplayKit/ASCollectionView.h +++ b/AsyncDisplayKit/ASCollectionView.h @@ -67,6 +67,13 @@ */ - (void)appendNodesWithIndexPaths:(NSArray *)indexPaths; +/** + * Query the sized node at `indexPath` for its calculatedSize. + * + * @param indexPath The index path for the node of interest. + */ +- (CGSize)calculatedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath; + @end diff --git a/AsyncDisplayKit/ASCollectionView.m b/AsyncDisplayKit/ASCollectionView.m index 04ec601cdf..aa20fe36bd 100644 --- a/AsyncDisplayKit/ASCollectionView.m +++ b/AsyncDisplayKit/ASCollectionView.m @@ -170,6 +170,11 @@ static BOOL _isInterceptedSelector(SEL sel) [_rangeController appendNodesWithIndexPaths:indexPaths]; } +- (CGSize)calculatedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath +{ + return [_rangeController calculatedSizeForNodeAtIndexPath:indexPath]; +} + #pragma mark Assertions. - (void)throwUnimplementedException