简体   繁体   English

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

[英]How to rotate original image without resizing(not expand width or height) the image

I have rotate the image using UIRotationGestureRecognizer and it's working fine. 我已经使用UIRotationGestureRecognizer旋转了图像,并且效果很好。 But the image width & height increased. 但是图像的宽度和高度增加了。

Original Image Size: x = 85.000000 , y = 83.000000 , width = 150.000000 , height = 150.000000 原始图像大小:x = 85.000000 ,y = 83.000000 ,宽度= 150.000000 ,高度= 150.000000
After rotating image size : x = 54.476551 , y = 52.476551 , width = 211.046906 , height = 211.046906 旋转图像的大小以后 :X = 54.476551,Y = 52.476551,宽度= 211.046906,高度= 211.046906

How to handle this problem? 如何处理这个问题? I am trying like this: 我正在这样尝试:

recognizer.view.transform = CGAffineTransformRotate(recognizer.view.transform, recognizer.rotation);
recognizer.rotation = 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;

I hope it helps 希望对您有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM