Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silence "Views without any layout constraints may clip their content" on a specific view controller that has preferredContentSize set

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.

like image 771
Tom Shen Avatar asked Jul 22 '18 08:07

Tom Shen


2 Answers

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.

like image 183
Hani Avatar answered Sep 20 '22 19:09

Hani


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".

like image 34
Daniel Avatar answered Sep 20 '22 19:09

Daniel