Stop viewSafeAreaInsetsDidChange() being called

I have a child view controller added and its view gets viewSafeAreaInsetsDidChange() called every time a frame change happens. how do I avoid this?

So far I am using these:

    self.viewRespectsSystemMinimumLayoutMargins = false
    self.view.insetsLayoutMarginsFromSafeArea   = false
    self.view.preservesSuperviewLayoutMargins.  = false

However, viewSafeAreaInsetsDidChange() is till being called. Is there a way to stop that?

Replies

You can't stop it from being called, its called when the safe area insets change for that view controller's view (also all of the methods you note affect layoutMargins not safeAreaInsets anyway).

What is the root issue you are trying to address?

I have a UIPickerView that reloads it self every time viewSafeAreaInsetsDidChange() is called. The view it self is the size of the UIPickerView.

I'm not sure why UIPickerView would do that, but we would probably recommend just moving the picker view so it no longer intersects with the safe area.