CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Dec 2014 |
Maintained by kishikawa katsumi.
PEPhotoCropEditor is image cropping library for iOS, similar to the Photos.app UI.
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;// e.g.) Cropping center square
CGFloat width = image.size.width;
CGFloat height = image.size.height;
CGFloat length = MIN(width, height);
controller.imageCropRect = CGRectMake((width - length) / 2,
(height - length) / 2,
length,
length);// e.g.) Cropping center square
CGFloat width = image.size.width;
CGFloat height = image.size.height;
CGFloat length = MIN(width, height);
self.cropView.imageCropRect = CGRectMake((width - length) / 2,
(height - length) / 2,
length,
length);[controller resetCropRect];[self.cropView resetCropRect];PEPhotoCropEditor is available under the MIT license. See the LICENSE file for more info.