Skip to content

tedz/PEPhotoCropEditor

 
 

Repository files navigation

PEPhotoCropEditor

version  platform  Build Status  Coverage Status

PEPhotoCropEditor is image cropping library for iOS, similar to the Photos.app UI.

ScreenShot 1 [Movie 1

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;

Keep crop aspect ratio while resizing

controller.keepingCropAspectRatio = YES;
self.cropView.keepingCropAspectRatio = YES;

About

Image cropping library for iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published