OGeek|极客世界-中国程序员成长平台

标题: ios - LTR 到 RTL 在 objective-c 中使用相同的 xib [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 14:38
标题: ios - LTR 到 RTL 在 objective-c 中使用相同的 xib

我坚持一个观点,我想开发一个同时支持 LTR 和 RTL 的应用程序,但我不想为 LTR 和 RTL 创建两个 .xib。

那么任何人都可以使用相同的 xib 为我提供任何可从 LTR 到 RTL 的方法。

提前谢谢你。



Best Answer-推荐答案


你可以通过改变语义来做到这一点

   self.anyView.semanticContentAttribute = .forceLeftToRight

   self.anyView.semanticContentAttribute = .forceRightToLeft

在objective-c中

 self.anyView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight;

或者

 self.anyView.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;

另见此演示:RTLDemo

关于ios - LTR 到 RTL 在 objective-c 中使用相同的 xib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49250123/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4