mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
[ASTableView/ASCollectionView] Ignore bounds.origin when checking for zero-size
This commit is contained in:
@@ -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];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 @[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user