问题描述
- 前提 : 自定义UICollectionViewFlowLayout:包含若干个UIScroll
- 理想现象 : 正常相应
- 报错reason :
2016-04-12 19:17:59.919 weather[95267:1467874] the behavior of the UICollectionViewFlowLayout is not defined because:
2016-04-12 19:17:59.920 weather[95267:1467874] 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.
- 解决方式 : 添加以下设置
self.automaticallyAdjustsScrollViewInsets = NO;
分析:
1.automaticallyAdjustsScrollViewInsets根据按所在界面的status bar,navigationbar,与tabbar的高度,自动调整scrollview的 inset,
2.设置为no,不让viewController调整,布局自定义
修改方法:
- (void)viewDidLoad
{
self.automaticallyAdjustsScrollViewInsets = NO;
[self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:ID];
}
简书地址:http://www.jianshu.com/users/227bbeb09f91/latest_articles
`