For rotation you need to apply
CGAffineTransform transform = CGAffineTransformTranslate(self.imageView.transform,deltaX,deltaY); transform = CGAffineTransformRotate(transform, recognizer.rotation); transform = CGAffineTransformTranslate(transform, -deltaX, -deltaY); self.imageView.transform = transform;
To crop, simply resize your image.
To convert local coordinates just use:
// converts a point in local coordinate space to window coordinates. [self.imageView convertPoint:localPosition toView:nil]; // use this method to calculate a view origin in window space like this: [self.imageView convertPoint:self.imageView.frame.origin toView:nil];
If you plan to integrate the image editor into your application, you can consider using a third party, for example: https://github.com/heitorfr/ios-image-editor
source share