Fix failing batch fetch in some cases. (#3242)

* Fixed failed batch fetch caused by _deceleratingVelocity

* Fixed indentation
This commit is contained in:
Heberti Almeida
2017-04-10 12:35:44 -04:00
committed by Adlai Holler
parent b41816d40d
commit 582bca93cb
3 changed files with 25 additions and 1 deletions

View File

@@ -181,6 +181,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
unsigned int scrollViewWillBeginDragging:1;
unsigned int scrollViewDidEndDragging:1;
unsigned int scrollViewWillEndDragging:1;
unsigned int scrollViewDidEndDecelerating:1;
unsigned int tableNodeWillDisplayNodeForRow:1;
unsigned int tableViewWillDisplayNodeForRow:1;
unsigned int tableViewWillDisplayNodeForRowDeprecated:1;
@@ -431,6 +432,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
_asyncDelegateFlags.tableViewDidEndDisplayingNodeForRow = [_asyncDelegate respondsToSelector:@selector(tableView:didEndDisplayingNode:forRowAtIndexPath:)];
_asyncDelegateFlags.tableNodeDidEndDisplayingNodeForRow = [_asyncDelegate respondsToSelector:@selector(tableNode:didEndDisplayingRowWithNode:)];
_asyncDelegateFlags.scrollViewWillEndDragging = [_asyncDelegate respondsToSelector:@selector(scrollViewWillEndDragging:withVelocity:targetContentOffset:)];
_asyncDelegateFlags.scrollViewDidEndDecelerating = [_asyncDelegate respondsToSelector:@selector(scrollViewDidEndDecelerating:)];
_asyncDelegateFlags.tableViewWillBeginBatchFetch = [_asyncDelegate respondsToSelector:@selector(tableView:willBeginBatchFetchWithContext:)];
_asyncDelegateFlags.tableNodeWillBeginBatchFetch = [_asyncDelegate respondsToSelector:@selector(tableNode:willBeginBatchFetchWithContext:)];
_asyncDelegateFlags.shouldBatchFetchForTableView = [_asyncDelegate respondsToSelector:@selector(shouldBatchFetchForTableView:)];
@@ -1199,6 +1201,15 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
_deceleratingVelocity = CGPointZero;
if (_asyncDelegateFlags.scrollViewDidEndDecelerating) {
[_asyncDelegate scrollViewDidEndDecelerating:scrollView];
}
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
for (_ASTableViewCell *tableViewCell in _cellsForVisibilityUpdates) {