From 772e9b95a4ade69a36fc9bc4a59a133b3f41c292 Mon Sep 17 00:00:00 2001 From: Levi McCallum Date: Mon, 12 Oct 2015 18:41:05 -0700 Subject: [PATCH] Document layout delegate on ASCollectionView --- AsyncDisplayKit/ASCollectionView.h | 9 +++++++-- AsyncDisplayKit/ASCollectionView.mm | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/AsyncDisplayKit/ASCollectionView.h b/AsyncDisplayKit/ASCollectionView.h index 1bd6344130..14ec90f894 100644 --- a/AsyncDisplayKit/ASCollectionView.h +++ b/AsyncDisplayKit/ASCollectionView.h @@ -63,7 +63,7 @@ * * @param asyncDataFetchingEnabled Enable the data fetching in async mode. * - * @discussion If asyncDataFetching is enabled, the `AScollectionView` will fetch data through `collectionView:numberOfRowsInSection:` and + * @discussion If asyncDataFetching is enabled, the `ASCollectionView` will fetch data through `collectionView:numberOfRowsInSection:` and * `collectionView:nodeForRowAtIndexPath:` in async mode from background thread. Otherwise, the methods will be invoked synchronically * from calling thread. * Enabling asyncDataFetching could avoid blocking main thread for `ASCellNode` allocation, which is frequently reported issue for @@ -83,7 +83,12 @@ /** * Optional introspection object for the collection view's layout. * - * TODO: Discuss more about this delegate + * @discussion Since supplementary and decoration views are controlled by the collection view's layout, this object + * is used as a bridge to provide information to the internal data controller about the existence of these views and + * their associated index paths. For collection views using `UICollectionViewFlowLayout`, a default inspector + * implementation `ASCollectionViewFlowLayoutInspector` is created and set on this property by default. Custom + * collection view layout subclasses will need to provide their own implementation of an inspector object for their + * supplementary views to be compatible with `ASCollectionView`'s supplementary node support. */ @property (nonatomic, weak) id layoutDelegate; diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index b7456be836..ccb1765c91 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -226,8 +226,8 @@ static BOOL _isInterceptedSelector(SEL sel) // and should not trigger a relayout. _ignoreMaxSizeChange = CGSizeEqualToSize(_maxSizeForNodesConstrainedSize, CGSizeZero); - // Register the default layout inspector delegate for flow layouts, custom layouts - // will need to roll their own ASCollectionViewLayoutInspecting implementation. + // Register the default layout inspector delegate for flow layouts only, custom layouts + // will need to roll their own ASCollectionViewLayoutInspecting implementation and set a layout delegate if ([layout asdk_isFlowLayout]) { _layoutDelegate = [self flowLayoutInspector]; }