Revisions based on feedback

This commit is contained in:
Ryan Nystrom
2015-02-24 16:55:12 -08:00
parent b3ae15858a
commit 8d7fe334e2
7 changed files with 65 additions and 53 deletions

View File

@@ -384,13 +384,13 @@ static BOOL _isInterceptedSelector(SEL sel)
}
}
- (BOOL)shouldFetchBatch
- (BOOL)shouldBatchFetch
{
if ([self.asyncDelegate respondsToSelector:@selector(shouldBatchFetchForCollectionView:)]) {
return [self.asyncDelegate shouldBatchFetchForCollectionView:self];
if ([_asyncDelegate respondsToSelector:@selector(shouldBatchFetchForCollectionView:)]) {
return [_asyncDelegate shouldBatchFetchForCollectionView:self];
} else {
// if the delegate does not respond to this method, there is no point in starting to fetch
return [self.asyncDelegate respondsToSelector:@selector(collectionView:beginBatchFetchingWithContext:)];
return [_asyncDelegate respondsToSelector:@selector(collectionView:willBeginBatchFetchWithContext:)];
}
}
@@ -398,13 +398,15 @@ static BOOL _isInterceptedSelector(SEL sel)
{
ASDisplayNodeAssert(_batchContext != nil, @"Batch context should exist");
if (![self shouldFetchBatch]) {
if (![self shouldBatchFetch]) {
return;
}
if (ASDisplayShouldFetchBatchForContext(_batchContext, [self scrollDirection], self.bounds, self.contentSize, targetOffset, _leadingScreensForBatching)) {
[_batchContext beginBatchFetching];
[self.asyncDelegate collectionView:self beginBatchFetchingWithContext:_batchContext];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[_asyncDelegate collectionView:self willBeginBatchFetchWithContext:_batchContext];
});
}
}