Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Autolayout Localization Behavior (RTL - Right To Left Behavior )

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?

like image 516
Abdalrahman Shatou Avatar asked Nov 11 '13 22:11

Abdalrahman Shatou


3 Answers

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.

Respect language direction

like image 145
Pavel Avatar answered Nov 07 '22 01:11

Pavel


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.

like image 44
Wain Avatar answered Nov 07 '22 01:11

Wain


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.

like image 4
Mohammad Zekrallah Avatar answered Nov 07 '22 01:11

Mohammad Zekrallah