[ASTableView/ASCollectionView] Ignore bounds.origin when checking for zero-size

This commit is contained in:
Adlai Holler
2016-07-18 12:01:33 -07:00
parent d4c5a09817
commit 50e8ad2e7c
2 changed files with 2 additions and 2 deletions

View File

@@ -1039,7 +1039,7 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
// Calling -indexPathsForVisibleItems will trigger UIKit to call reloadData if it never has, which can result // Calling -indexPathsForVisibleItems 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. // in incorrect layout if performed at zero size. We can use the fact that nothing can be visible at zero size to return fast.
BOOL isZeroSized = CGRectEqualToRect(self.bounds, CGRectZero); BOOL isZeroSized = CGSizeEqualToSize(self.bounds.size, CGSizeZero);
return isZeroSized ? @[] : [self indexPathsForVisibleItems]; return isZeroSized ? @[] : [self indexPathsForVisibleItems];
} }

View File

@@ -861,7 +861,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
// Calling indexPathsForVisibleRows will trigger UIKit to call reloadData if it never has, which can result // 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. // 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)) { if (CGSizeEqualToSize(self.bounds.size, CGSizeZero)) {
return @[]; return @[];
} }