Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also pass the crop rect to delegate. #62

Merged
merged 1 commit into from
Sep 15, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions DemoApp/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
3 changes: 2 additions & 1 deletion Lib/PECropViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
@end

@protocol PECropViewControllerDelegate <NSObject>

@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
4 changes: 3 additions & 1 deletion Lib/PECropViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down