【发布时间】:2019-05-25 19:10:17
【问题描述】:
为了在我的应用程序上支持从右到左,我正在使用以下说明:
[[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
[[UIStackView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
[UITextView appearance].textAlignment = NSTextAlignmentRight;
但是我有很多问题: - 如果我需要在当前视图中应用新的对齐方式,我不明白如何刷新 UI。 - 在集合视图中,即使我使用对齐方式也不会改变:
[[UICollectionView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
所以我决定使用:
self.sectionsCollectionView.transform = CGAffineTransformMakeScale(-1, 1);
和:
cell.transform = CGAffineTransformMakeScale(-1, 1);
它可以工作,但是如果我推送另一个视图并在我弹出到带有集合视图的视图后,它会再次向左对齐,直到我点击部分标题,点击后它向右。
【问题讨论】:
标签: ios objective-c right-to-left arabic-support