PerfectImageCropper
PerfectImageCropper copied to clipboard
Crash when dealloc is called.
You nil image in the dealloc. Which creates "Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'" in setImage when dealloc is called.
Do this:
- (void)setImage:(UIImage *)image
{
if (_image != image) {
_image = [image retain];
}
if (image != nil){ //check if image is nil
float _imageScale = self.frame.size.width / image.size.width;
self.imageView.frame = CGRectMake(0, 0, image.size.width*_imageScale, image.size.height*_imageScale);
_originalImageViewSize = CGSizeMake(image.size.width*_imageScale, image.size.height*_imageScale);
imageView.image = image;
imageView.center = CGPointMake(self.frame.size.width/2.0, self.frame.size.height/2.0);
}
}