iOS 11 UITableView中的额外顶部空间

前端之家收集整理的这篇文章主要介绍了iOS 11 UITableView中的额外顶部空间前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我在iOS 11 SDK上更新我的应用程序时,TableView开始表现奇怪,它增加了额外的顶部空间,但实际上额外的空间是Cell本身但它没有渲染,请在ios 11更新之前和之后查看附加图像.
谢谢!

this is after ios 11 update

Before ios 11

解决方法

代码中设置新属性contentInsetAdjustmentBehavior,它将解决问题.

if #available(iOS 11.0,*) {
    collectionView.contentInsetAdjustmentBehavior = .never
}

在iOS 11中添加了一个名为contentInsetAdjustmentBehavior的UIScrollView上的新属性,以确定调整内容偏移量

This property specifies how the safe area insets are used to modify the content area of the scroll view. The default value of this property is automatic.

猜你在找的Xcode相关文章