我向Image Set
添加了Asset Catalog
,并将其Direction
设置为Left to Right, Mirrors
。然后我在视图控制器中添加了UIImageView
,如果设备的语言设置为从右到左的语言,则图像会显示为翻转。
我希望它不要在这种情况下翻转,因为我手动管理应用程序内的母语。我尝试将UIImageView
的{{1}}设置为Semantic
无效。
答案 0 :(得分:2)
对我来说,以下工作:
将图像集的方向设置为Left to Right, Mirrors
。
强制UIImageView
的具体方向:
<强>目标C 强>
- (void)setImageView:(UIImageView *)imageView {
_imageView = imageView;
_imageView.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
}
<强>夫特强>
@IBOutlet weak var imageView: UIImageView! {
didSet {
imageView.semanticContentAttribute = .forceRightToLeft
}
}
现在,图像在LTR环境和RTL环境中进行镜像。如果我将其设置为.forceLeftToRight
,则图像不会在任何环境中被镜像。