My application is localized in both English and Arabic.
Unfortunately, sometimes the autolayout behavior for localization is not required. By that, I mean reversing the leading and trailing spaces. I want to override this behavior. Is there any way to do that?
To make leading act always as left (and trailing always like right), i.e. make it language independent, you can remove checkmark on "Respect language direction" on all constrains.
You can find this checkmark in constrain settings in the Attributes inspector under "First Item" button.
The attributes leading
and trailing
are the same as left
and right
for left-to-right languages such as English, but in a right-to-left environment such as Hebrew or Arabic, leading
and trailing
are the same as right
and left
. When you create constraints, leading
and trailing
are the default values. You should usually use leading
and trailing
to make sure your interface is laid out appropriately in all languages, unless you’re making constraints that should remain the same regardless of language.
So, for your special cases, don't use leading
and trailing
, instead, explicitly use left
and right
when you create your constraints.
as in @Pavel answer, you should turn off 'Respect language direction' property. if you have lots of constraints, you can open xib or storyboard file in XML view and replace all 'leading' values with 'left' and all 'trailing' values with 'right' and you're done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With