Cannot equal height to Superview in Xcode 11

前端 未结 4 2004
一生所求
一生所求 2021-01-01 20:30

I upgraded my Xcode today to 11 and just realised that Xcode doesn\'t allow me to create proportional height from a sub view to the view controller\'s root view anymore. I w

相关标签:
4条回答
  • 2021-01-01 20:38

    You can set your view equal to the Safe Area.

    If you still rely on having it equal to the root view itself, you can modify the constraint in the Attributes Inspector:

    0 讨论(0)
  • 2021-01-01 20:38

    In "Show the File inspector" tab, under Interface Builder Document enable "Use Safe Area Layout Guides" and set the view equal width or height to "SafeArea".

    Screenshot

    0 讨论(0)
  • 2021-01-01 20:47
    1. First do "Equal Widths " to any other UIView element .

    2. Go to Attributes inspector of the equal width contraint .

    3. Replace the Second Item with Superview.Width.

    credits: https://forums.developer.apple.com/thread/123284

    0 讨论(0)
  • 2021-01-01 20:53

    I have sent a bug report to Apple yesterday and also found the following discussion in Apple forums. I don't think I am the only developer experiencing this issue.

    Xcode 11 Add "Equal Width to Superview" Constraint?

    I am sure Apple will create a patch for this problem soon. So I decided to create a temporary solution by adding a new UIView named "Propotional View Helper" right under the root view. I gave trailing, leading, bottom and top constraints to its superview. Now I a able to drag to make equal width & height constraints to the superview.

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