mirror of
https://github.com/tappollo/IGListKit.git
synced 2026-04-28 20:05:01 +08:00
Full width item crashes grid layout
Summary: Fixed #352 Closes https://github.com/Instagram/IGListKit/pull/361 Differential Revision: D4365711 Pulled By: jessesquires fbshipit-source-id: 344b0c781cc807e0ff0bf381a5b12eaef3388d72
This commit is contained in:
committed by
Facebook Github Bot
parent
bfdc0383b7
commit
c3c0e36144
@@ -23,6 +23,8 @@ This release closes the [2.1.0 milestone](https://github.com/Instagram/IGListKit
|
||||
|
||||
- Fix out-of-bounds bug when child section controllers in a stack remove cells. [Ryan Nystrom](https://github.com/rnystrom) [(#358)](https://github.com/Instagram/IGListKit/pull/358)
|
||||
|
||||
- Fix a grid layout bug when item has full-width and iter-item spacing is not zero. [Bofei Zhu](https://github.com/zhubofei) [(#361)](https://github.com/Instagram/IGListKit/pull/361)
|
||||
|
||||
2.0.0
|
||||
-----
|
||||
|
||||
|
||||
@@ -219,6 +219,10 @@
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:i];
|
||||
id<UICollectionViewDelegateFlowLayout> delegate = (id<UICollectionViewDelegateFlowLayout>) collectionView.delegate;
|
||||
const CGSize itemSize = [delegate collectionView:collectionView layout:self sizeForItemAtIndexPath:indexPath];
|
||||
|
||||
IGAssertMainThread();
|
||||
IGAssert(itemSize.width <= self.contentWidth, @"The width of a single item must not exceed the width of the collection view.");
|
||||
|
||||
_IGListGridLayoutLine *lastLine = [self.lineCache lastObject];
|
||||
if (![lastLine addItemToTailWithSize:itemSize]) {
|
||||
// Not enough space for the last line
|
||||
@@ -260,7 +264,7 @@
|
||||
_minimumInteritemSpacing = spacing;
|
||||
_itemSizes = [NSMutableArray array];
|
||||
_headIndex = headIndex;
|
||||
_tailSpace = frame.size.width - self.minimumInteritemSpacing;
|
||||
_tailSpace = frame.size.width;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user