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

Avoid setting the imageView.image to nil before it has finished downloading image #494

Closed
ghost opened this issue Nov 1, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Nov 1, 2016

I have a feed of images (sort of like snapchat), so everytime I tap on the imageview i get the next prefetched image.
When using .kf.setImage it seems like for a split second it sets the imageView.image to nil before setting the cached/downloaded image in the imageview, which causes a flicker where it briefly shows the imageViews background color.
Is there a way to avoid this? Thought about setting the previous displayed image as a placeholder for the new one, but that's not the best solution.

So, is there a way one can wait setting the imageView's image until the image has actually completed downloading?

@onevcat
Copy link
Owner

onevcat commented Nov 1, 2016

I'll suggest to just use the current image of image view as the placeholder as you mentioned. It should be a fairly good and reasonable solution, at least to me.

What's your concern about that?

@ghost
Copy link
Author

ghost commented Nov 1, 2016

I guess it can work yeah, but it would feel 'safer' if there was a feature where you could wait setting the image in the imageview until the image has finished downloaded. I know that's possible with AlamofireImage, but I just prefer Kingfisher way more 👍

@ghost
Copy link
Author

ghost commented Nov 1, 2016

And thank you for the quick response! Really appreciate it.

@onevcat
Copy link
Owner

onevcat commented Nov 1, 2016

Um, I agree with you that it will be clearer to have an option to describe it explicitly, instead of just using current image. I will find some time to implement this.

Thanks.

@onevcat
Copy link
Owner

onevcat commented Nov 7, 2016

Added in 3.2.0

@onevcat onevcat closed this as completed Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant