UICollectionView出现the behavior of the UICollectionViewFlowLayout is not defined because:

2015-01-28 21:55:17.790 Demo[636:9351] the behavior of the UICollectionViewFlowLayout is notdefined because:

2015-01-28 21:55:17.791 Demo[636:9351]the item height must be less than the height of the UICollectionView minus thesection insets top and bottom values.

错误原因:

UICollectionViewFlowLayout的itemSize的宽或者高设置的有问题!它的size必须在父容器的范围之内!

另外一种情况就是使用到了:

[cell.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];

然后再对Cell进行初始化, 也会出现这个问题..

解决方法:

注册Cell的重用可以解决

原文地址:https://www.cnblogs.com/Rinpe/p/5063892.html