我刚刚开始编译到iOS 11,并注意到Apple现在声明了该属性
var automaticallyAdjustsScrollViewInsets: Bool { get set }
不推荐使用:
在iOS 11中还有其他属性可解决此警告吗?
默认值将保持为true还是将来将如何处理?
我刚刚开始编译到iOS 11,并注意到Apple现在声明了该属性
var automaticallyAdjustsScrollViewInsets: Bool { get set }
不推荐使用:
在iOS 11中还有其他属性可解决此警告吗?
默认值将保持为true还是将来将如何处理?
Answers:
现在,此属性的默认值为true。如果需要进行设置,则需要在将托管viewController的滚动视图中进行设置,并设置其属性contentInsetAdjustmentBehavior。下面是一个示例:
scrollView.contentInsetAdjustmentBehavior = .automatic
    scrollView.contentInsetAdjustmentBehavior = .never
                    此代码可以帮助:
if #available(iOS 11.0, *) {
    scrollView.contentInsetAdjustmentBehavior = .never
} else {
    automaticallyAdjustsScrollViewInsets = false
}
    scrollView什么
                    UIScrollView调整了插图的东西。例如在一个UICollectionViewController将会是self.collectionView,在一个UITableViewController将会是self.tableView。