Make UIView fill containing view using auto layout in Interface Builder instead of code

前端 未结 2 1005
温柔的废话
温柔的废话 2020-12-16 14:26

How do I use auto-layout to make a child view fill its parent, or at least anchor all its edges to the parent view\'s edges?

I am using all four vertical and horizon

相关标签:
2条回答
  • 2020-12-16 14:31

    I would just set all "Spacing to nearest neighbor" to 0, and align horizontal and vertical center. That should do the trick.

    0 讨论(0)
  • 2020-12-16 14:38

    Pin the top space to superview, bottom space to superview, leading space to superview and trailing space to superview.

    Pin

    Then set edit the constraints like so:

    Superview.Top >= View.Top and Superview.Bottom >= View.Bottom

    0 讨论(0)
提交回复
热议问题