I’ve gotten far enough to find out I should likely be using SDWebImage for populating the thumbnails in my UITableView with remote images.
My questions is, how can I have a default thumbnail in each cell that is visible as soon as the cell is displayed and before the SDWebImage finishes loading?
And I suppose the default thumbnail should also be displayed in the cases where there is no remote image available.
advice/suggestions?
thanks all
Initially you can set all cells to have the default image. You then can use a callback delegate to update the required cell to have the image once it is loaded. I currently use JMImageCache for my remote image processing which makes this very easy.
First, add the JMImageCache.h and JMImageCache.m files to your project. Assuming you are using a custom cell for your table called CustomCell which holds the image in an ImageViewer called imageViewer, import the JMImageCache.h file in CustomCell.h. Update your CustomCell interface to make it a JMImageCacheDelegate, also add an NSString image_url field:
We then need to handle when an image is finished downloading so that the cell’s image will be updated. Synthesize image_url and add the following to CustomCell.m.
Then in the file that has your tableView in the cell for row at index path function:
JMImageCache has a simple example on github if you need more assistance.