Here is my current implementation of the gesture recognizer:
- (IBAction)handleRotate:(UIRotationGestureRecognizer *)recognizer {
if([recognizer state] == UIGestureRecognizerStateEnded) {
_lastRotation = 0.0;
return;
}
CGFloat rotation = 0.0 - (_lastRotation - [recognizer rotation]);
CGAffineTransform currentTransform = self.container.transform;
CGAffineTransform newTransform = CGAffineTransformRotate(currentTransform,rotation);
[self.container setTransform:newTransform];
_lastRotation = [recognizer rotation];
}
Works fine. The problem is that self.container always rotates around it's center. I'd like it to rotate around the midpoint of the two touches, so that if you're zoomed in you can just rotate around the area you're touching. How do I do this?