gpt4 book ai didi

iphone - 通过触摸平滑旋转 UIView

转载 作者:搜寻专家 更新时间:2023-10-30 20:04:10 24 4
gpt4 key购买 nike

我想知道如何在我的代码中平滑 UITouch。我能够在我的 UIView 上检测到 UItouch,但是当我尝试使用 CGAffineTransform 旋转 View 时,它不会平滑旋转。对于这种旋转,我必须在 iPhone 上按下或长按手指触摸。如何执行平滑旋转,例如 Roambi Visualizer 应用程序。感谢您的帮助。

最佳答案

transform 是 UIView 的动画属性,因此可以使用 Core Animation 使旋转平滑:

CGAffineTransform newTransform = //...construct your desired transform here...
[UIView animateWithDuration:0.2
animations:^{view.transform = newTransform;}];

关于iphone - 通过触摸平滑旋转 UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5352255/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com