CollectionView报错: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报错:

2016-12-08 18:19:54.774 PandaTVHomeDemo[21698:1193380] 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.
2016-12-08 18:19:54.775 PandaTVHomeDemo[21698:1193380] The relevant UICollectionViewFlowLayout instance is <XYHomeContainerViewLayout: 0x7f843b207f60>, and it is attached to <XYHomeContainerView: 0x7f843880a000; baseClass = UICollectionView; frame = (0 0; 414 736); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x60800005c170>; layer = <CALayer: 0x60800002daa0>; contentOffset: {0, -64}; contentSize: {0, 0}> collection view layout: <XYHomeContainerViewLayout: 0x7f843b207f60>.
2016-12-08 18:19:54.775 PandaTVHomeDemo[21698:1193380] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.```

解决方法: 
在collectionView所在的控制器中设置以下属性即可解决:
```self.automaticallyAdjustsScrollViewInsets = No```
当此属性默认为YES时,导航控制器下的scrollView的contentInset会被自动调整为为{64, 0, 0, 0}bao
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容