Closed pcs289 closed 9 years ago
Hey, so I fixed this problem by changing the ImageCropViewControllerDelegate on the header to:
@protocol ImageCropViewControllerDelegate
@end
And on the .m:
(IBAction)done:(id)sender {
if ([self.delegate respondsToSelector:@selector(ImageCropViewController2:didFinishCroppingImage:)]) { UIImage *cropped; if (self.image != nil){ CGRect CropRect = self.cropView.cropAreaInImage; CGImageRef imageRef = CGImageCreateWithImageInRect([self.image CGImage], CropRect) ; cropped = [UIImage imageWithCGImage:imageRef]; CGImageRelease(imageRef); } [self.delegate ImageCropViewController2:self didFinishCroppingImage:cropped]; }
} @end
Thank you @matrpedreira, I would add @protocol ImageCropViewControllerDelegate <NSObject>
in the .h so that respondsToSelector: actually works
Probably better, the problem is that I don't have experience with Objective-C so just tried some stuff until it worked.
Hi Currently I am facing the same issue.
Do you have an example that can reproduce this issue so I can take a look?
On Wed, Oct 7, 2015 at 6:36 AM, ppsdang notifications@github.com wrote:
Hi Currently I am facing the same issue.
— Reply to this email directly or view it on GitHub https://github.com/myang-git/iOS-Image-Crop-View/issues/15#issuecomment-146149223 .
When instantiating the
ImageCropViewController(image: myUIImage)
it detects the initializer as the Delegate methodImageCropViewController(controller: UIViewController!, didFinishCroppingImage croppedImage: UIImage!)
so it expects the initializer to provide thecroppedImage
argument