Code Monkey home page Code Monkey logo

Comments (7)

eduardocallado avatar eduardocallado commented on June 19, 2024

Hey. I couldn't reproduce this crash here.
But I didn't understand one thing: how the performCloseAnimationWithScrollView: method was called, since its only called to dismiss images that was already on screen, and in this case, they are not from the web, so there is no loading. And since you said you pressed the done button while the image was loading, the only dismiss method called is dismissPhotoBrowserAnimated:.

from idmphotobrowser.

mythodeia avatar mythodeia commented on June 19, 2024

Hello
if you see inside the doneButtonPressed line 1247 there is a call for the performCloseAnimationWithScrollView.
i have uploaded a modified smaller sized sample to my dropbox. check it here:
https://dl.dropboxusercontent.com/u/34562882/IDMPhotoBrowser.zip

all you have to do is tap the cell to open the modal and immediately
either tap the done button before the image downloads
or drag the image down to dismiss it before the image downloads.

what i forgot to mention before is that it happens when calling this ...animatedFromView initializer of the IDMPhotoBrowser.
in my scenario i have a cell image that i want the animation to begin with thats why i use the animatedFromView:...

hope now you can understand where it crashes.
thanks

from idmphotobrowser.

Angelbear avatar Angelbear commented on June 19, 2024

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
*
* Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [160 nan]'

from idmphotobrowser.

mythodeia avatar mythodeia commented on June 19, 2024

This could be fixed with a check for nil like in my first post.
if someone has a more solid solution please share

thanks

from idmphotobrowser.

eduardocallado avatar eduardocallado commented on June 19, 2024

Now I get it. And I just fixed it.
Thank you guys for the help.

from idmphotobrowser.

mythodeia avatar mythodeia commented on June 19, 2024

No problem.
Glad I could be of assistance.

Thanks

Sent from my iPhone

On 8 Οκτ 2013, at 17:09, "Eduardo Callado" [email protected] wrote:

Now I get it. And I just fixed it.
Thank you guys for the help.


Reply to this email directly or view it on GitHub.

from idmphotobrowser.

iTofu avatar iTofu commented on June 19, 2024

I have the same problem and I checked the code, at -[IDMPhotoBrowser performCloseAnimationWithScrollView:] method, there are two lines:

float scaleX = senderViewOriginalFrame.size.width/scrollView.photoImageView.width;
float scaleY = senderViewOriginalFrame.size.height/scrollView.photoImageView.height;

scrollView.photoImageView.width and scrollView.photoImageView.height are both 0 when user taps the done button without waiting for the whole image to download, so it crashed.

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;
}

from idmphotobrowser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.