使用 UIPanGestureRecognizer 旋转视图

发布于 2024-09-11 19:13:23 字数 76 浏览 5 评论 0原文

是否可以使用 UIPanGestureRecognizer 旋转视图?我想要与旋转手势类似的功能,但只需一根手指。

谢谢。

Is it possible to rotate a view using a UIPanGestureRecognizer? I would like similar functionality to the rotation gesture but with only one finger.

Thanks.

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

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

发布评论

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

评论(2

胡大本事 2024-09-18 19:13:29

查看CGAffineTransformMakeRotation

这个网站应该有帮助。

http://chris-software.com/index .php/2009/04/26/animations-and-transformations/

来自站点:

# M_PI * 0.00 = 0° (original condition)
# M_PI * 0.25 = 45°
# M_PI * 0.50 = 90°
# M_PI * 0.75 = 135°
# M_PI * 1.00 = 180°
# M_PI * -0.75 = 225°
# M_PI * -0.50 = 270°
# M_PI * -0.25 = 315°

Check out CGAffineTransformMakeRotation.

This website should help.

http://chris-software.com/index.php/2009/04/26/animations-and-transformations/

From site:

# M_PI * 0.00 = 0° (original condition)
# M_PI * 0.25 = 45°
# M_PI * 0.50 = 90°
# M_PI * 0.75 = 135°
# M_PI * 1.00 = 180°
# M_PI * -0.75 = 225°
# M_PI * -0.50 = 270°
# M_PI * -0.25 = 315°
云醉月微眠 2024-09-18 19:13:28

当然。但当然,您需要自己进行旋转数学计算。如果您已经有了视图的旋转“中心点”,那么这特别有用,因为您可以跟踪触摸输入相对于该中心的角度,并应用视图的 transform 属性(或其他)当它更新时。

Sure. But you'll need to do your own rotation math, of course. If you have a "center point" of rotation for the view already, that's especially useful, as you can track the angle of the touch input relative to that center, and apply the transform property of the view (or whatever) when it updates.

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