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就可以了,希望对遇到同样问题的朋友有帮助

  • 相关阅读:
    【洛谷P3901】数列找不同
    【洛谷P2966】Cow Toll Paths
    【CH6901】骑士放置
    【洛谷P2215】上升序列
    【洛谷P1637】三元上升子序列
    【POJ2226】Muddy Fields
    【UVA1194】Machine Schedule
    【CH6803】导弹防御塔
    【CH6802】车的放置
    hdu 3572(构图+最大流)
  • 原文地址:https://www.cnblogs.com/zk1947/p/10338728.html
Copyright © 2011-2022 走看看