04 - the behavior of the UICollectionViewFlowLayout is not defined
阿新 • • 發佈:2019-01-08
問題描述
- 前提 : 自定義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
`