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

  • 相关阅读:
    odoo service error 更改端口号
    unique 唯一约束
    odoo 注册失败
    odoo 某个字段权限设置
    linux 定时任务
    odoo webside theme
    js 杂记
    vue3入门总结
    vue输出空格
    css等比例缩放图片
  • 原文地址:https://www.cnblogs.com/zk1947/p/10338728.html
Copyright © 2011-2022 走看看