相关疑难解决方法(0)

使用一根手指触摸在中心旋转图像

我想用一根手指触摸在中心点上旋转下面的图像...

我想用触摸旋转图像时显示带有标签的图像值.

我已完成图像旋转,但问题是如何根据旋转设置图像的值.

旋转角度增加,因此我无法设置该值.

谁能帮我?

代码如下

float fromAngle = atan2(firstLoc.y-imageView.center.y, 
                            firstLoc.x-imageView.center.x);

    NSLog(@"From angle:%f",fromAngle);
    float toAngle = atan2( currentLoc.y-imageView.center.y, 
                          currentLoc.x-imageView.center.x);

    NSLog(@"to Angle:%f",toAngle);
    // So the angle to rotate to is relative to our current angle and the
    // angle through which our finger moved (to-from)
    float newAngle =angle+(toAngle-fromAngle);


    NSLog(@"new angle:%.2f",newAngle);


 CGAffineTransform cgaRotate = CGAffineTransformMakeRotation(newAngle);

 imageView.transform=cgaRotate;


angle = newAngle;
Run Code Online (Sandbox Code Playgroud)

谁能帮我 ?

iphone image rotation

11
推荐指数
1
解决办法
4909
查看次数

标签 统计

image ×1

iphone ×1

rotation ×1