Search code examples
iosxcodeautolayout

How to fix "Fixed width constraints may cause clipping" warning in Xcode?


I have a button that is 50x50 in size, and I want it to be at the bottom right corner

enter image description here

And I've set it up using these constraints

enter image description here

But I get this warning, how to fix?

enter image description here


Solution

  • If you are showing a long text in the button, it will clip it. One way to silence the warning is setting the constraint to "greater than or equal". Select the constraint, click "Edit", then select ">=" next to "Constant". Or double click it (or select it in the storyboard pane) and select "greater than or equal" at the "relation" row.

    Check out @shades' answer for more details.