zoukankan      html  css  js  c++  java
  • the item height must be less than the height of 导航下scrollview产生偏移的问题

    最近用UICollectionView写了一个卡片轮播,ios12上效果完美,在ios10上跑了一下发现视图出现偏移,效果如下图

    找了好久原因最后发现在ios10上控制台打印了如下提示内容

     The behavior of the UICollectionViewFlowLayout is not defined because:
     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.
     The relevant UICollectionViewFlowLayout instance is <CollectionFlowLayout: 0x7f83d7d5d230>, and it is attached to <UICollectionView: 0x7f83d8111000; frame = (0 0; 375 160); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x600000058ba0>; layer = <CALayer: 0x600000221460>; contentOffset: {0, 0}; contentSize: {126, 111}> collection view layout: <CollectionFlowLayout: 0x7f83d7d5d230>.
     Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.

    上网查了下原因发现在ios11以下系统中导航控制器下当self.automaticallyAdjustsScrollViewInsets = YES;时,控制器下的scrollview的contentInset会默认向下偏移64,所以把这个属性设为NO就可以了,希望对遇到同样问题的朋友有帮助

  • 相关阅读:
    vs2005&sql2005
    根据老外的方法,GridVew实现多列排序.
    @好处多多
    系统启动后,自动启动软件方法.
    A4和B5纸张大小是按什么标准划分的?
    easyui控件的加载顺序
    jQuery模拟点击A标记
    求阶乘
    文件上传
    Andriod:环境搭建与配置
  • 原文地址:https://www.cnblogs.com/zk1947/p/10338728.html
Copyright © 2011-2022 走看看