diff --git a/CHANGELOG.md b/CHANGELOG.md index bf448613..d69f3595 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag - Fixed crash when using `-[IGListCollectionContext dequeueReusableCellOfClass:withReuseIdentifier:forSectionController:atIndex:]` [Jeremy Lawrence](https://github.com/ziewvater) (tbd) +- Fixed logic flaw in `[IGListCollectionViewLayout shouldInvalidateLayoutForBoundsChange:]`. [Allen Hsu](https://github.com/allenhsu) (tbd) 3.4.0 ----- diff --git a/Source/IGListCollectionViewLayout.mm b/Source/IGListCollectionViewLayout.mm index 98288ce4..5a439c23 100644 --- a/Source/IGListCollectionViewLayout.mm +++ b/Source/IGListCollectionViewLayout.mm @@ -415,13 +415,17 @@ static void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attribut - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { const CGRect oldBounds = self.collectionView.bounds; + // always invalidate for size changes + if (!CGSizeEqualToSize(oldBounds.size, newBounds.size)) { + return YES; + } + // if the y origin has changed, only invalidate when using sticky headers if (CGRectGetMinInDirection(newBounds, self.scrollDirection) != CGRectGetMinInDirection(oldBounds, self.scrollDirection)) { return self.stickyHeaders; } - // always invalidate for size changes - return !CGSizeEqualToSize(oldBounds.size, newBounds.size); + return NO; } - (void)prepareLayout {