如何使图像平滑旋转?
目前我正在使用 UIRotationGestureRecognizer 来旋转我的图像,并且我的图像当前旋转顺利。
我正在使用的代码是
CGFloat imageRotationDegree;
if ([gesture state] == UIGestureRecognizerStateBegan || [gesture state] == UIGestureRecognizerStateChanged)
{
[gesture view].transform = CGAffineTransformRotate([[gesture view] transform], [gesture rotation]);
[gesture setRotation:0];
imageRotationDegree=[gesture rotation];
}
NSLog(@"Rotation in Degrees: %f", imageRotationDegree);
所以问题是它总是将旋转度数打印为零。所以我无法保存当前的旋转度数。
另外,如果我将 [gesture setRotation:0]; 更改为其他程度,则旋转不平滑。
那么我怎样才能打印不同的旋转角度并平滑旋转。
Currently i am using UIRotationGestureRecognizer to rotate my image and my image currently rotating smoothly.
The code which i am using is
CGFloat imageRotationDegree;
if ([gesture state] == UIGestureRecognizerStateBegan || [gesture state] == UIGestureRecognizerStateChanged)
{
[gesture view].transform = CGAffineTransformRotate([[gesture view] transform], [gesture rotation]);
[gesture setRotation:0];
imageRotationDegree=[gesture rotation];
}
NSLog(@"Rotation in Degrees: %f", imageRotationDegree);
So the problem is it is always printing rotation degree as zero.So that i am unable to save the current rotation degree.
Also if i change [gesture setRotation:0];
to some other degree then rotation is not smooth.
So How can i print different rotation degree with smooth rotation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试与
try with