Safe area layout guides can be disabled in Interface Builder by unchecking the Use Safe Area Layout Guides
. How can this be done in code?
I didn't notice an iOS11-available boolean that directly corresponds with the checkbox.
You can disable safe area layout guide from storyboard for particular view controller. Select View Controller -> File Inspector (first tab) -> Use safe area layout guides (uncheck the checkbox). You can also change it programmatically in viewDidLoad(). Hope this Helps!
Enabling/Disabling Safe Area Layout Guide If you are creating a new xib or an storyboard in Xcode 9, safe area layout guide option is already enabled. You can disable this option explicitly by going into file inspector menu of Interface Builder and unchecking the option Use Safe Area Layout Guide.
To use the new safe area, select Safe Area Layout Guides in the File inspector for the view controller, and then add constraints between your content and the new safe area anchors. This prevents your content from being obscured by top and bottom bars, and by the overscan region on tvOS.
I think the only way to accomplish this programmatically is to override the safeAreaLayoutGuide property.
override var safeAreaLayoutGuide: UILayoutGuide {
return UILayoutGuide()
}
When you disable it through IB it still returns a UILayoutGuide but with zero layoutFrame, by returning an instance of UILayoutGuide, you are basically doing the same.
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