您好,欢迎来到二三四教育网。
搜索
您的当前位置:首页uicollectionViewFlowLayout报错

uicollectionViewFlowLayout报错

来源:二三四教育网

-23 14:00:11.408 JuheFinancialManagement[5054:140410] The behavior of the UICollectionViewFlowLayout is not defined because:2017-08-23 14:00:11.408 JuheFinancialManagement[5054:140410] 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-08-23 14:00:11.409 JuheFinancialManagement[5054:140410] The relevant UICollectionViewFlowLayout instance is, and it is attached to; layer =; contentOffset: {0, 0}; contentSize: {0, 0}> collection view layout:.

2017-08-23 14:00:11.409 JuheFinancialManagement[5054:140410] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.

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

解决:

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{

//宽度-2就可以小于collectionView的kscreenWidth,这个时候就不会报错

return CGSizeMake(kScreenWidth-2, 45);

}

Copyright © 2019- how234.cn 版权所有 赣ICP备2023008801号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务