iOS 11.0中不推荐使用“ automaticallyAdjustsScrollViewInsets” [英] 'automaticallyAdjustsScrollViewInsets' was deprecated in iOS 11.0

查看:848
本文介绍了iOS 11.0中不推荐使用“ automaticallyAdjustsScrollViewInsets”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始编译到iOS 11,并注意到Apple现在已声明该属性

I just started compiling up to iOS 11 and noticed that Apple now declared the property

var automaticallyAdjustsScrollViewInsets: Bool { get set }

不推荐使用:

< a href = https://developer.apple.com/documentation/uikit/uiviewcontroller/1621372-automaticallyadjustsscrollviewin rel = noreferrer> https://developer.apple.com/documentation/uikit/uiviewcontroller/1621372-automaticallyadjustsscrollviewin

还有另一个要修复的属性在iOS 11中会出现此警告吗?

Is there another property to fix this warning in iOS 11?

默认值会保持为true还是将来如何处理?

Will the default value stay true or how will this be handled in future?

推荐答案

此属性的默认值为true。如果需要进行设置,则需要在将托管viewController的滚动视图中进行设置,并设置其属性contentInsetAdjustmentBehavior。下面是一个示例:

The default for this property is now true. If you need to set this, you will need to set it in the scrollview that would host the viewController and set its property contentInsetAdjustmentBehavior. Below is an example:

scrollView.contentInsetAdjustmentBehavior = .automatic

这篇关于iOS 11.0中不推荐使用“ automaticallyAdjustsScrollViewInsets”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆