the behavior of the UICollectionViewFlowLayout is not defined because:
the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
该问题可能是因为宽度与高度不对导致的
自己遇到的问题:项目需要设置了一个collectionview的itemSize为屏幕宽度 ,但是最开始获取到的cell宽度可能只有320,这个时候如果itemsize大于320,就会报上面这个错,所以我们给collectionview加约束的时候,不要约束左右,而是应该约束left和width(最终需要展示的宽度),这样就可以避免这个错误了.
网友评论