在适配中东阿拉伯语言的环境下,我们可能需要用到RTL布局,有两个布局方式如下:
1.1storyboard布局
C4880BDD-71B3-4FFD-8104-BCC93804BBA4.png
选中Force Right-to-Left 就是RTL布局了。
2.1纯代码布局
可以在ViewController的基类里面加入以下代码
[UIView appearance].semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
[UISearchBar appearance].semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
self.navigationBar.semanticContentAttribute = [UIView appearance].semanticContentAttribute;