Closed sunbohong closed 8 years ago
Hey @sunbohong, thanks for the report and the pull! This sounds like an IGListKit bug, though. A frame with CGSizeZero is perfectly valid to the collection view. Have a closer look at what causes IGListKit to crash... (perhaps a division by zero? 😉 )
Hey @keighl , I use KTCenterFlowLayout in my project,but i don't have any headerview or footerview.
But now, KTCenterFlowLayout is different with UICollectionViewFlowLayout. It has more UICollectionViewLayoutAttributes for header and footer views.
(lldb) po [super layoutAttributesForElementsInRect:rect]
<__NSArrayM 0x6000000568f0>(
<UICollectionViewLayoutAttributes: 0x6000001f4100> index path: (<NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0}); frame = (0 0; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f3b00> index path: (<NSIndexPath: 0xc000000000000116> {length = 2, path = 1 - 0}); frame = (0 55; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f4400> index path: (<NSIndexPath: 0xc000000000000216> {length = 2, path = 2 - 0}); frame = (0 110; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f2900> index path: (<NSIndexPath: 0xc000000000000316> {length = 2, path = 3 - 0}); frame = (0 165; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f3800> index path: (<NSIndexPath: 0xc000000000000416> {length = 2, path = 4 - 0}); frame = (0 220; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f3100> index path: (<NSIndexPath: 0xc000000000000516> {length = 2, path = 5 - 0}); frame = (0 275; 320 55);
)
(lldb) po [self layoutAttributesForElementsInRect:rect]
<__NSArrayM 0x608000054970>(
<UICollectionViewLayoutAttributes: 0x6080001f3400> index path: (<NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0}); frame = (0 0; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f3700> index path: (<NSIndexPath: 0xc000000000000116> {length = 2, path = 1 - 0}); frame = (0 55; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f4600> index path: (<NSIndexPath: 0xc000000000000116> {length = 2, path = 1 - 0}); element kind: (UICollectionElementKindSectionHeader); frame = (0 55; 0 0); zIndex = 10; ,
<UICollectionViewLayoutAttributes: 0x6000001f3e00> index path: (<NSIndexPath: 0xc000000000000116> {length = 2, path = 1 - 0}); element kind: (UICollectionElementKindSectionFooter); frame = (0 55; 0 0); zIndex = 10; ,
<UICollectionViewLayoutAttributes: 0x6000001f3200> index path: (<NSIndexPath: 0xc000000000000216> {length = 2, path = 2 - 0}); frame = (0 110; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f3600> index path: (<NSIndexPath: 0xc000000000000216> {length = 2, path = 2 - 0}); element kind: (UICollectionElementKindSectionHeader); frame = (0 110; 0 0); zIndex = 10; ,
<UICollectionViewLayoutAttributes: 0x6000001f3400> index path: (<NSIndexPath: 0xc000000000000216> {length = 2, path = 2 - 0}); element kind: (UICollectionElementKindSectionFooter); frame = (0 110; 0 0); zIndex = 10; ,
<UICollectionViewLayoutAttributes: 0x6000001f2b00> index path: (<NSIndexPath: 0xc000000000000316> {length = 2, path = 3 - 0}); frame = (0 165; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f3d00> index path: (<NSIndexPath: 0xc000000000000316> {length = 2, path = 3 - 0}); element kind: (UICollectionElementKindSectionHeader); frame = (0 165; 0 0); zIndex = 10; ,
<UICollectionViewLayoutAttributes: 0x6000001f3000> index path: (<NSIndexPath: 0xc000000000000316> {length = 2, path = 3 - 0}); element kind: (UICollectionElementKindSectionFooter); frame = (0 165; 0 0); zIndex = 10; ,
<UICollectionViewLayoutAttributes: 0x6000001f2c00> index path: (<NSIndexPath: 0xc000000000000416> {length = 2, path = 4 - 0}); frame = (0 220; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f2d00> index path: (<NSIndexPath: 0xc000000000000416> {length = 2, path = 4 - 0}); element kind: (UICollectionElementKindSectionHeader); frame = (0 220; 0 0); zIndex = 10; ,
<UICollectionViewLayoutAttributes: 0x6000001f2300> index path: (<NSIndexPath: 0xc000000000000416> {length = 2, path = 4 - 0}); element kind: (UICollectionElementKindSectionFooter); frame = (0 220; 0 0); zIndex = 10; ,
<UICollectionViewLayoutAttributes: 0x6000001f3300> index path: (<NSIndexPath: 0xc000000000000516> {length = 2, path = 5 - 0}); frame = (0 275; 320 55); ,
<UICollectionViewLayoutAttributes: 0x6000001f4300> index path: (<NSIndexPath: 0xc000000000000516> {length = 2, path = 5 - 0}); element kind: (UICollectionElementKindSectionHeader); frame = (0 275; 0 0); zIndex = 10; ,
<UICollectionViewLayoutAttributes: 0x6000001f3900> index path: (<NSIndexPath: 0xc000000000000516> {length = 2, path = 5 - 0}); element kind: (UICollectionElementKindSectionFooter); frame = (0 275; 0 0); zIndex = 10;
)
(lldb)
thanks for your contributation i want use KTCenterFlowLayout in IGListKit. but now,it will lead to a crash.