如何在不调整图像大小(不扩展宽度或高度)的情况下旋转原始图像

时间:2012-09-06 13:36:44

标签: iphone

我使用UIRotationGestureRecognizer旋转图像并且工作正常。但图像宽度&身高增加了。

原始图像尺寸:x = 85.000000 ,y = 83.000000 ,宽度= 150.000000 ,身高= < EM> 150.000000
之后旋转图像尺寸:x = 54.476551 ,y = 52.476551 ,width = 211.046906 ,height = 211.046906

如何处理这个问题?我这样想:

recognizer.view.transform = CGAffineTransformRotate(recognizer.view.transform, recognizer.rotation);
recognizer.rotation = 0;

1 个答案:

答案 0 :(得分:0)

CGAffineTransform transform = self.view.transform;
            if (UIDeviceOrientationLandscapeLeft == deviceOrientation) {
                transform = CGAffineTransformRotate(transform, -(M_PI / 2.0));
            } else {
                transform = CGAffineTransformRotate(transform, M_PI / 2.0);
            }
            self.view.transform = transform;

我希望它有所帮助