1

Does anyone know of a good tutorial that shows how to lazy load images in a UITableView? I've searched online but the only one I found that looked like it did what I wanted was hard to follow because only parts of the code were shown and I'm new at this so I didn't understand how to hook everything up.

msgambel
  • 7,320
  • 4
  • 46
  • 62

3 Answers3

0

I suggest you check out the SDWebImage project on github, I use it for my table views when I need to load a remote image into the cells.

https://github.com/rs/SDWebImage

Daniel
  • 23,129
  • 12
  • 109
  • 154
  • Do you know of some tutorial? I'm very new at this and have a hard time understanding the code without some sort of direction – Kjhhkjhkkjkjjkh Hkjhkj Aug 14 '11 at 22:47
  • 1
    You really don't need a tutorial, if you download the code from the link, import the source into your project and all you need to do is include two files: "UIImageView+WebCache.h", "SDWebImageManager.h", then you can call setImageWithURL:placeholderImage: onto your UIImageView and you're set – Daniel Aug 15 '11 at 09:12
  • Aahh ok, I thought it was code I was going to have to implement for my project. That worked perfectly! Thank you so much. – Kjhhkjhkkjkjjkh Hkjhkj Aug 15 '11 at 18:31
0

As Daniel suggested SDWebImage https://github.com/rs/SDWebImage, I don't know of any tutorial, but in amongst the KTPhotoBrowser samples there is one that uses SDWebImage that can show you how to do it https://github.com/kirbyt/KTPhotoBrowser/tree/master/src/Sample/Classes/SDWebImageSample

If I remember correctly you need to import and use the SDWebImage UIImageView category and then pass the url to the cell and call

setImageWithURL:[NSURL URLWithString:@"yoururl"] placeholderImage:[UIImage imageNamed:@"placeholder.png"] 

when setting the cell image.

doppioslash
  • 1,276
  • 11
  • 14
0

I haven't actually followed it, but this one has plenty of positive commentary: http://www.markj.net/iphone-asynchronous-table-image/

Robot Woods
  • 5,677
  • 2
  • 21
  • 30