[ASRangeController] Don't bother asking UIKit for the visible index paths if view is zero-sized, as it triggers a reloadData.

This commit is contained in:
Scott Goodson
2016-03-10 19:10:25 -08:00
parent aab2ecc26e
commit 0e460ca00a
3 changed files with 21 additions and 5 deletions

View File

@@ -718,6 +718,12 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
{
ASDisplayNodeAssertMainThread();
// Calling indexPathsForVisibleRows will trigger UIKit to call reloadData if it never has, which can result
// in incorrect layout if performed at zero size. We can use the fact that nothing can be visible at zero size to return fast.
if (CGRectEqualToRect(self.bounds, CGRectZero)) {
return @[];
}
NSArray *visibleIndexPaths = self.indexPathsForVisibleRows;
if (_pendingVisibleIndexPath) {