PEPhotoCropEditor
PEPhotoCropEditor is image cropping library for iOS, similar to the Photos.app UI.
License
MIT License
Features
- Both iPhone/iPad available
- Works fine any device orientations
- Support pinch gesture to zoom
- Support rotation gesture
System requirements
- iOS 5.0 or higher
Installation
CocoaPods
pod 'PEPhotoCropEditor'
Usage
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];
Get the cropped image
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;