【发布时间】:2010-08-16 15:32:32
【问题描述】:
又是我。我有一个简单的问题。我有一个如下所示的 UIImageView。 alt text http://img683.imageshack.us/img683/1999/volumen.png
那个 UIimageView 应该是控制我 iphone 项目音量的旋钮。我的问题是,当 UIImageView 旋转时,如何知道它的位置?因为当圆环上的小条垂直时,音量需要为0.5。
我得到了一段代码(在 touchMoved 方法中):
float dx = locationT.x - imgVVolume.center.x;
float dy = locationT.y - imgVVolume.center.y;
CGFloat angleDif = 0.0f;
movedRotationAngle = atan2(dy,dx);
if (beganRotationAngle == 0.0) {
beganRotationAngle = movedRotationAngle;
initialTransform = imgVVolume.transform;
}
else {
angleDif = beganRotationAngle - movedRotationAngle;
CGAffineTransform newTrans = CGAffineTransformRotate(initialTransform, -angleDif);
imgVVolume.transform = newTrans;
}
请帮忙。
【问题讨论】:
-
怎么了?问题是什么?
-
问题是如何知道imageview的位置从而调整音量
-
那不是您要找的角度吗?可能你必须把它们加在一起:)
标签: iphone ipad animation uiimageview