Disable Safe Area Layout Guides For UIView Programmatically

11,424

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.

Share:
11,424
kev
Author by

kev

Updated on June 15, 2022

Comments

  • kev
    kev about 2 years

    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.