views:

68

answers:

1

I have around 20 tableview cells that each contain a number (2-5) thumbnail sized pictures (they are VERY small Facebook profile pictures, ex. http://profile.ak.fbcdn.net/hprofile-ak-sf2p/hs254.snc3/23133_201668_2989_q.jpg). Each picture is an UIImageView added to the cell's contentview.

Scrolling performance is poor, and measuring the draw time I've found the UIImage rendering is the bottleneck.

I've researched/thought of some solutions but as I am new to iphone development I am not sure which strategy to pursue:

  • preload all the images and retrieve them from disk instead of URL when drawing cells (I'm not sure if cell drawing will still be slow, so I want to hold off on the time investment here)
  • Have the cells display a placeholder image from disk, while the picture is asynchronously loaded (this seems to be the best solution, but I'm currently not sure exactly how to do best do this)
  • There's the fast drawing recommendation from Tweetie, but I don't know that will have much affect if it turns out my overhead is in network loading (http://blog.atebits.com/2008/12/fast-scrolling-in-tweetie-with-uitableview/)

Thoughts/implementation advice? Thanks!

+2  A: 

Suggest you do a search in the XCode help docs for LazyTableImages. It's a sample app provided by Apple that asynchronously loads images into a table cell. It should be a good starting point.

You'll probably want to add a local cache to save the images so you don't have to keep downloading them each time, and a way to prune out old images out of the cache.

Ramin
That's perfect, thanks for pointing me in the right direction Ramin!Caching may not be that big of a concern at the moment - I don't anticipate the user spending too much time on this main screen (may only scroll through it once or twice) and it has static content (for now). Definitely will need to cache in the future though.
ambertch