ios - UITableViewCell 不会为 RTL objective-c 翻转 subview

标签 ios objective-c uitableview

我在我的应用程序中使用 NSLocalization,不幸的是, View 没有将其框架的原点切换为 RTL。

英语 enter image description here

阿拉伯语 enter image description here

对于阿拉伯语,图像应该位于标签的左侧,但它不会出现在整个应用程序中。只有标签改变了文本对齐方式,其他一切都一样。

为什么它没有发生。对于阿拉伯语,我也设置了语义:

[[UITextView appearance]setTextAlignment:NSTextAlignmentRight]
[[UITableViewCell appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];

对于英语:

[[UITextView appearance]setTextAlignment:NSTextAlignmentLeft];
[[UITableViewCell appearance]setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];

最佳答案

你必须有“Leading”和“Trailing”两个约束(而不是 Left 和 Right ),你最好使用 Masonry 。当您有一些约束时,您可以使用 SemanticContentAttribute。

关于ios - UITableViewCell 不会为 RTL objective-c 翻转 subview ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44042150/

相关文章:

ios - NSOperationQueue 不限制并发操作

iphone - cocos2d中如何在特定位置移动对象

objective-c - 无法解释的错误访问错误

ios - 如何以编程方式更改或制作新的启动图像?

ios - 使用 block 会自动创建新线程吗?

ios - 从 MyTableViewController 中的方法 'viewDidLoad' 获取 MyTableViewCell?

iphone - iOS - UiTableviewCell - 背景图片一次只显示在一个单元格上

ios - fetchedResultsController.fetchedObjects.count = 0 但它充满了对象

ios - NSLocalizedString 与从应用程序切换语言

objective-c - 为什么继承需要是 "subclass"NSObject?