Silence “Views without any layout constraints may

2019-04-29 16:30发布

I have a view controller that's fixed size (it can not be resized). This specific view controller is presented as a sheet in a window, I disabled the resizing by setting preferredContentSize. Since it can't be resized anymore, I left the view without any constraint. However, when I build the app, I got a lot of warnings that says :

Views without any layout constraints may clip their content or overlap other views.

I do know that if you don't add any constraints in a standard window it will clip when it is resized. However, resizing is disabled on my specific window so that I know it won't happen. Is there a way to silence this warning? There are a lot of views on this specific view controller and it's blocking other useful warnings that I may encounter in the issues navigator.

This view controller is presented through a "Sheet" segue.

2条回答
我想做一个坏孩纸
2楼-- · 2019-04-29 17:09

I had a single warning saying the same thing.

Editor > Resolve Auto Layout Issues > Add Missing Constraints

worked for me. If it doesn't for you, something else under "Resolve Auto Layout Issues" might work.

查看更多
Rolldiameter
3楼-- · 2019-04-29 17:21

For me what worked was the reposition the elements: Drag them again into position and drag their height and width to the desired size again. Then click on "Resolve Auto Layout Issues" and click on "Reset to Suggested Constraints".

查看更多
登录 后发表回答