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
crash when user taps the done button without waiting for the whole image to download #32
Comments
Hey. I couldn't reproduce this crash here. |
Hello all you have to do is tap the cell to open the modal and immediately what i forgot to mention before is that it happens when calling this ...animatedFromView initializer of the IDMPhotoBrowser. hope now you can understand where it crashes. |
hello @eduardocallado , The problem is https://github.com/ideaismobile/IDMPhotoBrowser/blob/master/Classes/IDMPhotoBrowser.m#L385 When call the performCloseAnimationWithScrollView, UIImage imageFromView = [scrollView.photo underlyingImage]; was called, but for remote loading image, underlyingImage is nil before loadUnderlyingImageAndNotify. So float scaleFactor = imageFromView.size.width / screenWidth; got 0, and when some number divide scaleFactor, it gets NaN, which cause the problem of |
This could be fixed with a check for nil like in my first post. thanks |
Now I get it. And I just fixed it. |
No problem. Thanks Sent from my iPhone
|
I have the same problem and I checked the code, at float scaleX = senderViewOriginalFrame.size.width/scrollView.photoImageView.width;
float scaleY = senderViewOriginalFrame.size.height/scrollView.photoImageView.height;
My solution is that: float scaleX = 0;
if (scrollView.photoImageView.width > 0) {
scaleX = senderViewOriginalFrame.size.width/scrollView.photoImageView.width;
}
float scaleY = 0;
if (scrollView.photoImageView.height > 0) {
scaleY = senderViewOriginalFrame.size.height/scrollView.photoImageView.height;
} |
Hello
i experienced a crash right when the user taps on a cell image, the modal opens and the progress is being shown to download an image from the web.
if you do not wait for the whole image to download and hit the DONE button the method performCloseAnimationWithScrollView crashes when setting the resizableImageView frame size, since the imageFromView is nil.
a solution would be an if statement like this:
if (imageFromView == nil) {
// in case the user taps the DONE button without
// waiting for the whole image to download
resizableImageView.frame = CGRectZero;
}
else{
.......
if you find any better solution please share.
thanks
The text was updated successfully, but these errors were encountered: