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

Image not zoomable due to async download of the large image #72

Open
jeromeDms opened this issue Nov 3, 2016 · 1 comment
Open

Image not zoomable due to async download of the large image #72

jeromeDms opened this issue Nov 3, 2016 · 1 comment

Comments

@jeromeDms
Copy link

Hi
I found an issue.

startFocusingView calls focusViewControllerForView
in the above focusViewControllerForView, the large image is loaded asynchronously as follow:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ [self loadImageFromURL:url onImageView:viewController.mainImageView]; viewController.mainImageView.hidden = NO; });
While the image is downloading, the animation starts, at the end of the animation, the following function is called:
[self.focusViewController focusDidEndWithZoomEnabled:self.zoomEnabled];

This function calls installZoomView which calls displayImage which calls configureForImageSize which calls setMaxMinZoomScalesForCurrentBounds

BUT

If the large image (async loading) is still not loaded from the server, zooming is not possible since setMaxMinZoomScalesForCurrentBounds results in maximumZoomScale = minimumZoomScale = 1.0 (calculation done on low resolution image, since the large image is still loading)

@jeromeDms
Copy link
Author

jeromeDms commented Nov 3, 2016

My workaround is to call [self.focusViewController focusDidEndWithZoomEnabled:self.zoomEnabled]; once the large image has been loaded in focusViewControllerForView:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
      [self loadImageFromURL:url onImageView:viewController.mainImageView];
      if(viewController.scrollView.hidden == NO)
            {
                 viewController.mainImageView.hidden = NO;
                 dispatch_async(dispatch_get_main_queue(), ^{
                     [self.focusViewController focusDidEndWithZoomEnabled:self.zoomEnabled];
                     self.isZooming = NO;
                  });
         }
        });

and obviously remove below code from startFocusingView animation completion

[self.focusViewController focusDidEndWithZoomEnabled:self.zoomEnabled];

The above seems to work fine in my case, nobody observed a similar issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant