I can get pinch/zoom functionality working like this:
- (void)twoFingerPinch:(UIPinchGestureRecognizer *)recognizer
{
if([recognizer state] == UIGestureRecognizerStateBegan) {
_lastScale = 1.0;
}
CGFloat scale = 1.0 - (_lastScale - [recognizer scale]);
CGAffineTransform currentTransform = self.imageForEditing.transform;
CGAffineTransform newTransform = CGAffineTransformScale(currentTransform, scale, scale);
[self.imageForEditing setTransform:newTransform];
_lastScale = [recognizer scale];
}
The problem is that the image zooms based on it's center, so if you first pan the image so that it's not centered, then pinch/zoom, it doesn't zoom into the area between the touches. I figure this must be a common issue that has been addressed and solved but I haven't been able to find a solution.