mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
ASCollectionView batch API
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#import <AsyncDisplayKit/ASRangeController.h>
|
||||
#import <AsyncDisplayKit/ASCollectionViewProtocols.h>
|
||||
#import <AsyncDisplayKit/ASBaseDefines.h>
|
||||
#import <AsyncDisplayKit/ASBatchContext.h>
|
||||
|
||||
|
||||
@class ASCellNode;
|
||||
@@ -62,6 +63,13 @@
|
||||
*/
|
||||
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout asyncDataFetching:(BOOL)asyncDataFetchingEnabled;
|
||||
|
||||
/**
|
||||
* The number of screens left to scroll before the delegate -collectionView:beginBatchFetchingWithContext: is called.
|
||||
*
|
||||
* Defaults to one screenful.
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat leadingScreensForBatching;
|
||||
|
||||
/**
|
||||
* Reload everything from scratch, destroying the working range and all cached nodes.
|
||||
*
|
||||
@@ -166,6 +174,34 @@
|
||||
- (void)collectionView:(ASCollectionView *)collectionView willDisplayNodeForItemAtIndexPath:(NSIndexPath *)indexPath;
|
||||
- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNodeForItemAtIndexPath:(NSIndexPath*)indexPath;
|
||||
|
||||
/**
|
||||
* Tell the collectionView if batch fetching should begin.
|
||||
*
|
||||
* @param 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.
|
||||
*/
|
||||
- (BOOL)shouldBatchFetchForCollectionView:(UICollectionView *)collectionView;
|
||||
|
||||
/**
|
||||
* Receive a message that the collectionView is near the end of its data set and more data should be fetched if
|
||||
* necessary.
|
||||
*
|
||||
* @param tableView The sender.
|
||||
* @param 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.
|
||||
*
|
||||
* UICollectionView currently only supports batch events for tail loads. If you require a head load, consider
|
||||
* implementing a UIRefreshControl.
|
||||
*/
|
||||
- (void)collectionView:(UICollectionView *)collectionView beginBatchFetchingWithContext:(ASBatchContext *)context;
|
||||
|
||||
@end
|
||||
|
||||
@interface ASCollectionView (Deprecated)
|
||||
|
||||
Reference in New Issue
Block a user