diff --git a/DemoApp/ViewController.m b/DemoApp/ViewController.m index 2d72ecc..ceae304 100644 --- a/DemoApp/ViewController.m +++ b/DemoApp/ViewController.m @@ -40,11 +40,10 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfa #pragma mark - PECropViewControllerDelegate methods -- (void)cropViewController:(PECropViewController *)controller didFinishCroppingImage:(UIImage *)croppedImage +- (void)cropViewController:(PECropViewController *)controller didFinishCroppingImage:(UIImage *)croppedImage transform:(CGAffineTransform)transform cropRect:(CGRect)cropRect { [controller dismissViewControllerAnimated:YES completion:NULL]; self.imageView.image = croppedImage; - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { [self updateEditButtonEnabled]; } diff --git a/Lib/PECropViewController.h b/Lib/PECropViewController.h index dbd98ca..36243f3 100644 --- a/Lib/PECropViewController.h +++ b/Lib/PECropViewController.h @@ -36,8 +36,9 @@ @end @protocol PECropViewControllerDelegate - +@optional - (void)cropViewController:(PECropViewController *)controller didFinishCroppingImage:(UIImage *)croppedImage; +- (void)cropViewController:(PECropViewController *)controller didFinishCroppingImage:(UIImage *)croppedImage transform:(CGAffineTransform)transform cropRect:(CGRect)cropRect; - (void)cropViewControllerDidCancel:(PECropViewController *)controller; @end diff --git a/Lib/PECropViewController.m b/Lib/PECropViewController.m index 4e525ad..2218449 100644 --- a/Lib/PECropViewController.m +++ b/Lib/PECropViewController.m @@ -214,7 +214,9 @@ - (void)cancel:(id)sender - (void)done:(id)sender { - if ([self.delegate respondsToSelector:@selector(cropViewController:didFinishCroppingImage:)]) { + if ([self.delegate respondsToSelector:@selector(cropViewController:didFinishCroppingImage:transform:cropRect:)]) { + [self.delegate cropViewController:self didFinishCroppingImage:self.cropView.croppedImage transform: self.cropView.rotation cropRect: self.cropView.zoomedCropRect]; + } else if ([self.delegate respondsToSelector:@selector(cropViewController:didFinishCroppingImage:)]) { [self.delegate cropViewController:self didFinishCroppingImage:self.cropView.croppedImage]; } }