开发者

iPhone disk image loading in tableView (Photo application like)

I have a question about the best performance approach...

  1. Basically I have a UITableView, with cells and 4 images inside the cell. (The similar Photo Application thumbnail preview); 24 images seen...

  2. Images in cells are loaded asynchronously from URL address and when downloaded they are saved in Documents directory on iPhone.

I would like to have the same performance as the PHOTO application has when scrolling the thumbnails but I am getting slight choppy table movement...

What you recommend as best approach to use the already loaded images to present from disk and maintain the table scrolling fluent...

What you think about:

  1. Making NSOperation that will load the thumb from disk (4 concurrent operations); 1 operation per image...

  2. 开发者_如何学编程
  3. Making NSOperation that will load 4,8,16 ? images to memory in loop;

  4. Other better approach ?

Thanks


Before you invest too much time in this, you should check out the Three20 iPhone framework. It provides a view controller that replicates Photo's image picker very closely:

http://three20.info/overview

If you decide not to use Three20, you should at least make sure your solution loads and unloads images asynchronously; that way your table interface won't be choppy regardless of how long the disk reads take. If you use UIImageViews and use +[UIImage imageWithContentsOfFile:] to get UIImages, then UIKit will handle the rest for you.

You should also consider storing separate thumbnail images along will the full-size images for the purposes of this view. That will save you read time and memory, and it's precisely what the Photo application does.

If you do one or more of the above, I doubt that disk reads will be a bottleneck for you!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜