ASCollectionDelegate Protocol Reference

Conforms to ASCommonCollectionDelegate
NSObject
Declared in ASCollectionNode.h

Overview

This is a node-based UICollectionViewDelegate.

– collectionNode:constrainedSizeForItemAtIndexPath:

Provides the constrained size range for measuring the given item.

- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath

Parameters

collectionNode

The sender.

indexPath

The index path of the item.

Return Value

A constrained size range for layout for the item at this index path.

Declared In

ASCollectionNode.h

– collectionNode:willBeginBatchFetchWithContext:

Receive a message that the collection node is near the end of its data set and more data should be fetched if necessary.

- (void)collectionNode:(ASCollectionNode *)collectionNode willBeginBatchFetchWithContext:(ASBatchContext *)context

Parameters

collectionNode

The sender.

context

A context object that must be notified when the batch fetch is completed.

Discussion

You must eventually call -completeBatchFetching: with an argument of YES in order to receive future notifications to do batch fetches. This method is called on a background queue.

ASCollectionNode currently only supports batch events for tail loads. If you require a head load, consider implementing a UIRefreshControl.

Declared In

ASCollectionNode.h

– shouldBatchFetchForCollectionNode:

Tell the collection node if batch fetching should begin.

- (BOOL)shouldBatchFetchForCollectionNode:(ASCollectionNode *)collectionNode

Parameters

collectionNode

The sender.

Discussion

Use this method to conditionally fetch batches. Example use cases are: limiting the total number of objects that can be fetched or no network connection.

If not implemented, the collection node assumes that it should notify its asyncDelegate when batch fetching should occur.

Declared In

ASCollectionNode.h

– collectionView:constrainedSizeForNodeAtIndexPath:

Provides the constrained size range for measuring the node at the index path.

- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath

Parameters

collectionView

The sender.

indexPath

The index path of the node.

Return Value

A constrained size range for layout the node at this index path.

Declared In

ASCollectionNode.h

– collectionView:willDisplayNode:forItemAtIndexPath:

Informs the delegate that the collection view will add the given node at the given index path to the view hierarchy.

- (void)collectionView:(ASCollectionView *)collectionView willDisplayNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath

Parameters

collectionView

The sender.

node

The node that will be displayed.

indexPath

The index path of the item that will be displayed.

Discussion

Warning: AsyncDisplayKit processes collection view edits asynchronously. The index path passed into this method may not correspond to the same item in your data source if your data source has been updated since the last edit was processed.

Declared In

ASCollectionNode.h

– collectionView:didEndDisplayingNode:forItemAtIndexPath:

Informs the delegate that the collection view did remove the provided node from the view hierarchy. This may be caused by the node scrolling out of view, or by deleting the item or its containing section with @c deleteItemsAtIndexPaths: or @c deleteSections: .

- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath

Parameters

collectionView

The sender.

node

The node which was removed from the view hierarchy.

indexPath

The index path at which the node was located before it was removed.

Discussion

Warning: AsyncDisplayKit processes collection view edits asynchronously. The index path passed into this method may not correspond to the same item in your data source if your data source has been updated since the last edit was processed.

Declared In

ASCollectionNode.h

– shouldBatchFetchForCollectionView:

Tell the collectionView if batch fetching should begin.

- (BOOL)shouldBatchFetchForCollectionView:(ASCollectionView *)collectionView

Parameters

collectionView

The sender.

Discussion

Use this method to conditionally fetch batches. Example use cases are: limiting the total number of objects that can be fetched or no network connection.

If not implemented, the collectionView assumes that it should notify its asyncDelegate when batch fetching should occur.

Declared In

ASCollectionNode.h

– collectionView:willDisplayNodeForItemAtIndexPath:

Informs the delegate that the collection view will add the node at the given index path to the view hierarchy.

- (void)collectionView:(ASCollectionView *)collectionView willDisplayNodeForItemAtIndexPath:(NSIndexPath *)indexPath

Parameters

collectionView

The sender.

indexPath

The index path of the item that will be displayed.

Discussion

Warning: AsyncDisplayKit processes collection view edits asynchronously. The index path passed into this method may not correspond to the same item in your data source if your data source has been updated since the last edit was processed.

This method is deprecated. Use @c collectionView:willDisplayNode:forItemAtIndexPath: instead.

Declared In

ASCollectionNode.h