首页 > 代码库 > 刷新CollectionView 报错the item height must be less that the height of the UICollectionView minus the s

刷新CollectionView 报错the item height must be less that the height of the UICollectionView minus the s

数据请求到了之后 刷新CollectionView 出现下面的错误。

the behavior of the UICollectionViewFlowLayout is not defined because:

2015-03-16 10:56:45.898 XXXXX [664:60b] the item height must be less that the height of the UICollectionView minus the section insets top and bottom values.


有可能是数据在插入之前,页面还没有加载完,导致的错误。

网上找了好久,只要假如一句话就解决问题了:

 self.automaticallyAdjustsScrollViewInsets = NO;  

automaticallyAdjustsScrollViewInsets

为YES时,它会找view里的scrollView,并设置scrollView的contentInset为{64, 0, 0, 0}。如果你不想让scrollView的内容自动调整,将这个属性设为NO(默认值YES)。

 

刷新CollectionView 报错the item height must be less that the height of the UICollectionView minus the s