clarify assert message

Summary:
* Clarify assert message by adding item width/height
 * Before: Width of item 1 in section 2 must be less than container 375 accounting for section insets {0, 0, 0, 0}
 * After: Width of item 1 in section 2 (415 pt) must be less than or equal to container (375 pt) accounting for section insets {0, 0, 0, 0}

Reviewed By: rnystrom

Differential Revision: D6711829

fbshipit-source-id: be99e83fd68cd345cb6a05acdde27c8252e59650
This commit is contained in:
Maxime Ollivier 2018-01-16 07:35:21 -08:00 committed by Facebook Github Bot
parent 82b52b2050
commit a8275e08e1

View file

@ -492,11 +492,14 @@ static void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attribut
const CGSize size = [delegate collectionView:collectionView layout:self sizeForItemAtIndexPath:indexPath];
IGAssert(CGSizeGetLengthInDirection(size, fixedDirection) <= paddedLengthInFixedDirection
|| fabs(CGSizeGetLengthInDirection(size, fixedDirection) - paddedLengthInFixedDirection) < FLT_EPSILON,
@"%@ of item %zi in section %zi must be less than container %.0f accounting for section insets %@",
self.scrollDirection == UICollectionViewScrollDirectionVertical ? @"Width" : @"Height",
item, section, CGRectGetLengthInDirection(contentInsetAdjustedCollectionViewBounds, fixedDirection),
NSStringFromUIEdgeInsets(insets));
|| fabs(CGSizeGetLengthInDirection(size, fixedDirection) - paddedLengthInFixedDirection) < FLT_EPSILON,
@"%@ of item %zi in section %zi (%.0f pt) must be less than or equal to container (%.0f pt) accounting for section insets %@",
self.scrollDirection == UICollectionViewScrollDirectionVertical ? @"Width" : @"Height",
item,
section,
CGSizeGetLengthInDirection(size, fixedDirection),
CGRectGetLengthInDirection(contentInsetAdjustedCollectionViewBounds, fixedDirection),
NSStringFromUIEdgeInsets(insets));
CGFloat itemLengthInFixedDirection = MIN(CGSizeGetLengthInDirection(size, fixedDirection), paddedLengthInFixedDirection);