Question

When setting your device to a Right-To-Left language, iOS reverses the order of items.

For example in a UITableViewCell set with Auto-Layout: I have an avatar image on the left and some text aligned right from it that fills up the rest of the cell. In Arabic my avatar is on the right and my label is on the left.

Is there a way to prevent iOS from doing this on certain views, or is there a general setting defining whether or not it can be reversed?

Was it helpful?

Solution 2

You can set the 'direction' property of a spacing layout to "Left to Right" instead of the default: "Leading to trailing". This way the views will not be mirrored in RTL languages.

Unfortunately, you have to set this for every constraint of the views you don't want mirrored. Constraints added with code can be set this way: [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[_photoView]-0-|" options:NSLayoutFormatDirectionLeftToRight metrics:nil views:views]];

OTHER TIPS

For Xcode6 and iOS8 you can uncheck Respect language direction for the horizontal constrains like below:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top