iOS本地化搞乱了UI

iOS本地化搞乱了UI,第1张

概述我有一个支持不同语言的iOS应用程序,它使用LTR Storyboard和RTL Storyboard,并从Plists中读取.当我在带有英文iOS版本的设备上运行应用程序时,在语言之间切换时,一切看起来都很完美.但是当我将iPhone OS语言改为RTL语言时.用户界面搞砸了. 特别是当我启用本地化以更改主屏幕上的应用程序名称时,会发生这种情况. 知道为什么会这样吗? 例如,整个菜单搞砸了,它应 我有一个支持不同语言的iOS应用程序,它使用LTR Storyboard和RTL Storyboard,并从PLists中读取.当我在带有英文iOS版本的设备上运行应用程序时,在语言之间切换时,一切看起来都很完美.但是当我将iPhone OS语言改为RTL语言时.用户界面搞砸了.

特别是当我启用本地化以更改主屏幕上的应用程序名称时,会发生这种情况.

知道为什么会这样吗?

例如,整个菜单搞砸了,它应该在左侧,而它应该在右侧,菜单项图标必须在左侧,标签在右侧.

LTR iOS语言设备上的RTL语言,即英语
  

RTL iOS语言设备上的RTL语言

解决方法 这是因为您使用前导和尾随约束.
在LTR环境中,领导意味着在RTL环境中,领先意味着正确.
这是Apple帮助我们轻松处理RTL / LTR的方式:[在您的情况下,不是那么多……
要禁用此行为,请更改视图的语义属性.

Semantic Content

If you lay out your vIEws using leading and trailing constraints,the
vIEws automatically flip positions when switching between
left-to-right languages (like English) and right-to-left languages
(like arabic). However,some interface elements should not change
their position based on the reading direction. For example,buttons
that are based on physical directions (up,down,left,and right)
should always stay in the same relative orIEntation.

The vIEw’s semanticContentAttribute property determines whether the
vIEw’s content should flip when switching between left-to-right and
right-to-left languages.

In interface builder,set the Semantic option in the Attribute inspector. If the value is UnspecifIEd,the vIEw’s content flips with the reading direction. If it is set to Spatial,Playback,or Force left-to-Right,the content is always laID out with the leading edges to the left and trailing edges to the right. Force Right-to-left always lays out the content with the leading edges to the right and the trailing edges to the left.

总结

以上是内存溢出为你收集整理的iOS本地化搞乱了UI全部内容,希望文章能够帮你解决iOS本地化搞乱了UI所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1005897.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存