0
votes

I had a problem regarding rotation of an image in my code using rotation gesture. After spending some time on SO I got a link to Ray Wenderlich's tutorial on UIGestureRecognizers.

Initially my view was rotating and scaling very fast on corresponding gestures and this link has a nice tutorial on using them properly. However I could not understand why did setting rotation and scale to there normal values 0 and 1 respectively solved the problem.

Here's the link to the tutorial

http://www.raywenderlich.com/6567/uigesturerecognizer-tutorial-in-ios-5-pinches-pans-and-more

UIPinchGestureRecognizer and UIRotationGestureRecognizer is the section I am referring to.

1

1 Answers

1
votes
- (IBAction)handlePinch:(UIPinchGestureRecognizer *)recognizer {    
    recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale, recognizer.scale);
    recognizer.scale = 1;    
}

The code first create a new transform from the recognizer scale and assign it to your view. After that it reset the scale to 1.

This is actually consider the scaling to the view each time start from 1. Similar to the rotation, we consider the rotation degree start from 0 every time it called.