意见反映在RTL语言

问题描述:

当您的设备设置为从右到左书写的语言,iOS的反转项目的顺序。

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

例如在一个UITableViewCell设定自动布局:我在左边头像图片和一些文字直接从它的对齐填补了电池的剩余部分。在阿拉伯语中我的头像是在右边,我的标签是在左边。

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.

有从某些视图这样的方式prevent的iOS,还是有一个普遍的设置定义它是否能够逆转?

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?

您可以设置间距布局的方向属性设置为左到右,而不是默认:通往尾随。这样的观点不会RTL语言进行镜像。

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.

不幸的是,你必须设置本作不希望反映的意见每一约束。与code加约束,可以这样设置:
[个体经营addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@H:| -0 - [_的PhotoView] -0- |选项​​:NSLayoutFormatDirectionLeftToRight指标:无意见:意见];

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]];