README and documentationIGListKit version: 2.1.0Self-sizing cell layouts, as shown in the SelfSizingCellsViewController example, break when the inset.right or inset.left values for the section controller are non-zero.
The following console output is shown when inset.left is set to 10, instead of the current value of 0, in the example SelfSizingSectionController.
2017-01-23 21:00:30.619 IGListKitExamples[17836:3387117] The behavior of the UICollectionViewFlowLayout is not defined because:
2017-01-23 21:00:30.619 IGListKitExamples[17836:3387117] the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values.
2017-01-23 21:00:30.619 IGListKitExamples[17836:3387117] Please check the values returned by the delegate.
2017-01-23 21:00:30.620 IGListKitExamples[17836:3387117] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7ff28ec159a0>, and it is attached to <IGListCollectionView: 0x7ff28f030200; baseClass = UICollectionView; frame = (0 0; 414 736); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x60000005d220>; layer = <CALayer: 0x600000035920>; contentOffset: {0, -64}; contentSize: {0, 0}> collection view layout: <UICollectionViewFlowLayout: 0x7ff28ec159a0>.
2017-01-23 21:00:30.620 IGListKitExamples[17836:3387117] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
[This set of messages is shown a whole bunch of times, presumably for each separate self-sizing view in the controller.]
@HarshilShah This seems to be a flow layout problem. After setting insets to 10, the width of the section is containerWidth + 10 + 10, which is larger than the width of the collectionView. This is not allowed in UICollectionViewFlowLayout.
@HarshilShah Set
func sizeForItem(at index: Int) -> CGSize {
return CGSize(width: collectionContext!.containerSize.width - 20, height: 55)
}
in SelfSizingSectionController should solve your issue.
20 = inset.left + inset.right
@zhubofei This solved it, thanks!
Most helpful comment
@zhubofei This solved it, thanks!