【发布时间】:2011-01-17 16:21:53
【问题描述】:
谁能告诉我如何根据用户给出的触摸旋转视图....
我的意思是我想做出类似旧电话的外观(按下并旋转拨号...)...
我非常了解如何旋转,但根据这种情况无法旋转.....
【问题讨论】:
-
我刚刚在这里写了一个很长的答案:stackoverflow.com/questions/1119743/…
标签: iphone
谁能告诉我如何根据用户给出的触摸旋转视图....
我的意思是我想做出类似旧电话的外观(按下并旋转拨号...)...
我非常了解如何旋转,但根据这种情况无法旋转.....
【问题讨论】:
标签: iphone
你需要一个只有表盘图像的视图。
This view has a center C(x,y)
First, the view will be touched at coordinate T0(x,y)
if the x and y is within the circle do the tracking:
Then the finger will move to coordinate Tn(x,y)
Find the angle made up by Tn(x,y) C(x,y) T0(x,y) //(See below for a reference)
and do the rotation using that angle as you already know ;)
else
do nothing since the touch is not in the dial
【讨论】:
计算开始触摸与表盘中心 (atan2f(y - yc, x - xc)) 之间的角度,并将其用作确定每个后续触摸事件所需的旋转的基础角度。
【讨论】: