โ ๏ธ Fixed leading and trailing constraints may cause clipping
When using storyboard and auto-layout we see sometimes this warning
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
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.
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
Done, no more warnings ๐ช
Subscribe to my newsletter
Read articles from Rui Aureliano directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Rui Aureliano
Rui Aureliano
๐ Hi, I'm Rui Aureliano. ๐ In my spare time, I build Sip.