iOS - 解决the behavior of the UICollectionViewFlowLayout is not defined

文/大L君(简书作者)
原文链接:http://www.jianshu.com/p/b7798ac5ad3d
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
问题描述
  • 前提 : 自定义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];
}

`


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值