I just started compiling up to iOS 11 and noticed that Apple now declared the property
var automaticallyAdjustsScrollViewInsets: Bool { get set }
as being deprecated:
https://developer.apple.com/documentation/uikit/uiviewcontroller/1621372-automaticallyadjustsscrollviewin
Is there another property to fix this warning in iOS 11?
Will the default value stay true or how will this be handled in future?
This code may help:
if #available(iOS 11.0, *) {
scrollView.contentInsetAdjustmentBehavior = .never
} else {
automaticallyAdjustsScrollViewInsets = false
}
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
You can also set this in Interface Builder. Select your tableView or collectionView then select from the drop-down in the Size Inspector select .never for 'Content Insets Adjustment Behavior'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With