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
Asynchronous loading images in galleryviewcontroller #59
Comments
Hi.. here it is. You have to make something a GalleryItemsDatasource and respond to a delegate callback. In that, you return an Enum case with associated value that is the async block that takes the image. This might seem like an overcomplicated solution but it's the only way to let the gallery setup itself properly (it needs to know the type of contents in advance) and then get the images in asynchronous way later ...
You can pass the imageProcessing block as a completion block to some other async operation. The signature of the block is UIImage? -> Void. |
This helped! Closing |
Hello, reopening this since after doing some testing it seems that the image isn't being updated when the async call comes back with an image. Basically, when i present the galleryviewcontroller, it first tries to download the image, when the image returns, it calls the imageProcessingBlock. The problem is after it calls it nothing happens. Only after scrolling a bit to the left or to the right does the image come back. My code looks like this
|
You are calling the imageCompletion(image) block twice in downloadImageWithURL. I think the second occurrence is not necessary and is actually causing the problem. |
I'd think it's the other way around. From the name |
@zfoltin is right...I missed the "progress" in the problem. |
Thanks @zfoltin @Krisiacik for response. I should've posted a simpler example but both progressImage and imageCompletion return an image. I tested the issue with just the single completion block and the issue still persists.
|
If you use a different image provider - assets library/ google images/ whatever.., does the issue presist? |
Hey @osolano I'm trying to resolve this issue and have a few questions for you. I'm not sure, but my suspicion is that PINRemoteImageManager's completion might be called on a background thread. Can you try to wrap the Many thanks for your help in figuring this out. |
Hello,
I've been having trouble figuring out how to setup the asynchronous loading of images in galleryviewcontroller. Could you provide a snippet that will give me a hint on how to do this?
The text was updated successfully, but these errors were encountered: