我正在尝试实施UIRotationGestureRecognizerfor UIImageView。
UIRotationGestureRecognizer *rotateGesture = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotate:)];
[self.view addGestureRecognizer:rotateGesture];
在选择器方法中,我没有这个
-(void)rotate:(UIRotationGestureRecognizer *)gesture
{
    if ([gesture state] == UIGestureRecognizerStateBegan || [gesture state] == UIGestureRecognizerStateChanged) {
        selectedImage.transform=CGAffineTransformRotate(selectedImage.transform, gesture.rotation);
        [gesture setRotation:0];
    }
}
使用上面的代码,图像正在旋转。但是,问题是,图像中心正在改变。这样,图像旋转看起来有点尴尬。
图像的初始中心(277,653)
在旋转时,值不断增加(365,659)  ,然后又回到(277,653)。
可能是什么原因?怎么解决中心问题?如何使我的图像在UIImageView使用中心旋转UIRotationGestureRecognizer?