Cannot equal height to Superview in Xcode 11

旧时模样 提交于 2019-12-18 15:01:10

问题


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 was able to do it till this morning with the previous Xcode version. The only workaround is to add another sub root view to the controller and move everything under it. This option will take too much time to re-design the setup the controller.

Are you experiencing the same problem?

This is from the new Xcode 11. As you can see there is no equal height or width option to superview anymore.

And this pic is from one of my Views that I created it's constraint in previous Xcode. As you can see there is a proportional constraint equals to the ViewController's superview with 0.65 ratio.

I don't wanna add a mid root view to the view controller. It will be just a time wasting process. Any ideas? Am I missing a new magic button or +?


回答1:


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:




回答2:


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.



来源:https://stackoverflow.com/questions/58105491/cannot-equal-height-to-superview-in-xcode-11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!