Support for dynamic ranges

This refactors how we do ranges and implements tuning parameters for a "Render" range and a "Preload" range
This commit is contained in:
Ryan Nystrom
2015-01-30 14:01:32 -08:00
parent 43be3294bc
commit 9c877c51af
9 changed files with 199 additions and 48 deletions

View File

@@ -10,6 +10,7 @@
#import <AsyncDisplayKit/ASRangeController.h>
#import <AsyncDisplayKit/ASCollectionViewProtocols.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
@class ASCellNode;
@@ -29,11 +30,24 @@
@property (nonatomic, weak) id<ASCollectionViewDelegate> asyncDelegate;
/**
* Tuning parameters for the working range.
* Tuning parameters for a range.
*
* Defaults to a trailing buffer of one screenful and a leading buffer of two screenfuls.
* @param range The range to get the tuning parameters for.
*
* @returns A tuning parameter value for the given range.
*
* Defaults to the render range having one sceenful both leading and trailing and the preload range having two
* screenfuls in both directions.
*/
@property (nonatomic, assign) ASRangeTuningParameters rangeTuningParameters;
- (ASRangeTuningParameters)tuningParametersForRange:(ASLayoutRange)range;
/**
* Set the tuning parameters for a range.
*
* @param tuningParameters The tuning parameters to store for a range.
* @param range The range to set the tuning parameters for.
*/
- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRange:(ASLayoutRange)range;
/**
* Initializer.
@@ -153,3 +167,9 @@
- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNodeForItemAtIndexPath:(NSIndexPath*)indexPath;
@end
@interface ASCollectionView (Deprecated)
@property (nonatomic, assign) ASRangeTuningParameters rangeTuningParameters ASDISPLAYNODE_DEPRECATED;
@end