Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download image asynchronously

I need to download an image from the web and display it in an ImageView. Presently I am using SDWebImage (It is an asynchronous image downloader with cache support, with a UIImageView category).

But it crashes when I click the back button and forward button (when I try to go back and forth of the view repeatedly). Anyway this happens very rarely, but I need to get rid of this bug. Is there any other library (that does not use private API's) that I could use in my project?

like image 477
shajem Avatar asked Nov 28 '22 11:11

shajem


1 Answers

Yes. You can user other libary. I've already implemented that using AsyncImageView which is inherited from UIImageView. What it does is it stores images in Cache memory fetched from a url and whenever you need to load image from the same URL again it will simply load it from the cache memory saving a lot of time.

Just follow the link for implementing that:

https://github.com/nicklockwood/AsyncImageView#readme

http://www.markj.net/iphone-asynchronous-table-image/

Please have a look at the image showing the technique I've implemented. It lets you do other activity while images are loading.:

enter image description here

like image 159
rohan-patel Avatar answered Dec 06 '22 02:12

rohan-patel