Insert subview that follows safe areas?

Hi,


Is there a way I can programatically insert a subview into a superview in such a way that the subview automatically adjusts its insets?


For example, let's say I have an ordinary UIView in my layout which is pinned to the bottom of the superview (not the safe area, but the superview itself, such that the home button overlays it).


In my code, I want to insert a table view into that view in such a way that the tableview is pinned to the top, left, bottom and right, which puts the bottom of the tableview at the same location as the bottom of the screen.


When I do this, the tableview doesn't adjust its insets to match the safe area of the screen. By contrast, if I insert a tableview into a view directly using interface builder, it does.


Frank

Replies

I feel like the right way to do this would be to make sure the subview's safe area is equal to that of the superview, but these are not settable properties.