Rui Aureliano
Rui Aureliano

Rui Aureliano

⚠️ Fixed leading and trailing constraints may cause clipping

Rui Aureliano's photo
Rui Aureliano
·Nov 7, 2019·

1 min read

When using storyboard and auto-layout we see sometimes this warning

1.png

So what does this means? after some digging this seems to happen when using components with text, and seems to be related to localization.

So I made this simple sample, just a UIView with padding of 100px and a UILabel with padding of 50px

2.png

And there is the warning 😡

⚠️ warning: Auto Layout Localization: Fixed leading and trailing constraints may cause clipping, one of them should have a constant ≥ standard space.

The message is self-explanatory, it's related to leading and/or trailing for this particular UILabel, the suggestion is to use ≥, which breaks this sample.

3.png

To fix this (not 100% of the implications for other languages), but for the leading and trailing just remove the option for Respect Language Direction.

Select the leading constraint, and for Attributes Inspector, select the dropdown and remove the option for Respect Language Direction. After that, you should see LABEL.left instead of LABEL.leading

4.png

Done, no more warnings 💪

 
Share this