UICollectionView 报错

系统版本:IOS_11_0

报错内容:

The behavior of the UICollectionViewFlowLayout is not defined because:
2017-11-29 10:45:10.220202+0800 GHK_AfarWheel[42989:627216] 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.
2017-11-29 10:45:10.221984+0800 GHK_AfarWheel[42989:627216] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7fc5e0e28de0>, and it is attached to <UICollectionView: 0x7fc5e1895000; frame = (0 0; 414 180); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x60000045dd60>; layer = <CALayer: 0x604000230a40>; contentOffset: {414, 0}; contentSize: {2070, 180}; adjustedContentInset: {64, 0, 0, 0}> collection view layout: <UICollectionViewFlowLayout: 0x7fc5e0e28de0>.
2017-11-29 10:45:10.222138+0800 GHK_AfarWheel[42989:627216] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.

解决办法:

  #ifdef __IPHONE_11_0

    if (@available(iOS 11.0, *)) {

        _collectionView.contentInsetAdjustmentBehavior = UIApplicationBackgroundFetchIntervalNever;
    }
  #endif
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容