镜像 UIView

发布于 2024-11-30 14:48:45 字数 388 浏览 3 评论 0原文

我正在开发一个支持多种语言的应用程序。为了支持从右到左开始的语言,我正在转换视图,以便右侧的视图转移到左侧,如下图所示:

转换前查看

在此处输入图像描述

我正在使用以下代码来转换view

 self.view.transform = CGAffineTransformMakeScale(-1, 1);

我现在想做的是改造将视图置于左侧的新位置以删除镜像文本。例如,我想围绕其中心翻转“FLIP LABEL”,以便正确显示文本。我该怎么做?

I am working on an application that supports multiple languages. In order to support languages that start from right to left, I am transforming the view so that views on the right side get shifted to left side as shown in the images below:

View Before Transforming

enter image description here

I am using the following code to transform the view

 self.view.transform = CGAffineTransformMakeScale(-1, 1);

What I now want to do is transform the views in its new position in the left to remove the mirrored text. For example, I want to flip the "FLIP LABEL" about its center so that the text is displayed properly. How do I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

说谎友 2024-12-07 14:48:45

您可以尝试在各个子视图上再次运行相同的转换 - 例如:

for (UIView *view in self.view.subviews) {
    view.transform = CGAffineTransformMakeScale(-1, 1);
}

(或者可能是 CGAffineTransformMakeScale(1, 1)?我不太确定。)

You could try running the same transform again on the individual subviews - for example:

for (UIView *view in self.view.subviews) {
    view.transform = CGAffineTransformMakeScale(-1, 1);
}

(Or maybe it would be CGAffineTransformMakeScale(1, 1)? I'm not totally sure.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文