uiview旋转保持1坐标不变

发布于 2024-10-15 06:49:59 字数 531 浏览 10 评论 0原文

再会!

我想问,如果我想将 uiview 放在另一个视图的前面,但我想通过保持其 1 点不变来实现它,这样看起来只有 1(顶部)部分向下移动。我将 uiview 设置为 90 度,但我不知道如何使其水平。这是 uiview 的代码

clView.frame = CGRectMake(0,100,258,171);
clView.transform = CGAffineTransformIdentity;
clView.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
[self.view addSubview:clView];

现在它将我的视图设置为 90 度,但我无法通过动画保持一点不变来降低它。就像抛射运动一样。有人可以帮我吗?

黄色圆圈部分我想保持静止和其他移动,90 度并恢复正常

黄色圆圈部分我想保持静止和其他移动,90 度并恢复正常

Good Day!

i want to ask that if i want to bring a uiview in front on another view, but i want to bring it by keeping its 1 points constant so that it looks like that only 1 (top) portion moved down. i put my uiview on 90 degrees but i could not figure out the way to bring it horizontal. here is code for uiview

clView.frame = CGRectMake(0,100,258,171);
clView.transform = CGAffineTransformIdentity;
clView.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
[self.view addSubview:clView];

Now it puts my view to 90 degrees but i could not bring it down with animation keeping one point constant. like projectile motion. Can somebody help me out ?

Yellow circle part i want to be still and other moving, 90 degress and back to normal

Yellow circle part i want to be still and other moving, 90 degress and back to normal

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

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

发布评论

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

评论(1

披肩女神 2024-10-22 06:49:59

您可能想要将底层 CALayer 的锚点设置为代表黄色圆圈中间的任何坐标。就像这样:

myView.layer.anchorPoint = CGPointMake(x,y); // where x and y is the middle of the yellow circle.

一旦设置了锚点,就会对该点进行变换。

此页面对此有更多详细信息。

You probably want to set the anchorPoint of the underlying CALayer, to whatever coordinates represent the middle of the yellow circle. So something like:

myView.layer.anchorPoint = CGPointMake(x,y); // where x and y is the middle of the yellow circle.

Once you've set the anchorPoint, transforms will be done about that point.

This page has more detail on this.

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