PEPhotoCropEditor is image cropping library for iOS, similar to the Photos.app UI.
MIT License
- Both iPhone/iPad available
- Works fine any device orientations
- Support pinch gesture to zoom
- Support rotation gesture
- iOS 5.0 or higher
pod 'PEPhotoCropEditor'
Use view controller component
PECropViewController *controller = [[PECropViewController alloc] init];
controller.delegate = self;
controller.image = self.imageView.image;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller];
[self presentViewController:navigationController animated:YES completion:NULL];
Or use the crop view directly
self.cropView = [[PECropView alloc] initWithFrame:contentView.bounds];
[self.view addSubview:self.cropView];
delegate method
- (void)cropViewController:(PECropViewController *)controller didFinishCroppingImage:(UIImage *)croppedImage
{
[controller dismissViewControllerAnimated:YES completion:NULL];
self.imageView.image = croppedImage;
}
retrieve from view directly
UIImage *croppedImage = self.cropView.croppedImage;
controller.keepingCropAspectRatio = YES;
self.cropView.keepingCropAspectRatio = YES;