0

I have rotate the image using UIRotationGestureRecognizer and it's working fine. But the image width & height increased.

Original Image Size: x = 85.000000, y = 83.000000, width = 150.000000, height = 150.000000
After rotating image size : x = 54.476551, y = 52.476551, width = 211.046906, height = 211.046906

How to handle this problem? I am trying like this:

recognizer.view.transform = CGAffineTransformRotate(recognizer.view.transform, recognizer.rotation);
recognizer.rotation = 0;
6
  • simply rotate it then dont use the UIGesture ... Sep 6, 2012 at 13:38
  • I need rotation gesture. So that only I used.
    – Mani
    Sep 6, 2012 at 13:38
  • ImageView.transform=CGAffineTransformMakeRotation(M_PI / -2); this worked for me and there is no change in the image size.... Sep 6, 2012 at 13:40
  • Using your code, Is it possible to user rotate the image and change the scale of the image?
    – Mani
    Sep 6, 2012 at 13:42
  • For scaling u gotta use the gesture ... this will only help u rotate the image on one point.... Sep 6, 2012 at 13:49

1 Answer 1

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

2
  • Thanks matheszabi. Using your code Is it possible to user can change the image rotation? I think it is static rotation. I want user to interact the image.
    – Mani
    Sep 6, 2012 at 13:46
  • just change the self to your variable, like rotation, need to adapt. Sorry if doesn't match 1000% of your needs, and doesn't help you at all
    – user529543
    Sep 6, 2012 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.