Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableView - Lazy loading contact images
    primarykey
    data
    text
    <p>I'm working on an iPhone application which displays thumbnail images from contacts in a UITableView.</p> <p>Everything is very fast until I turn on the thumbnails, then it becomes very slow to scroll. All the other data is backed by Core Data and I tried saving the images in Core Data beforehand, but this in itself takes too long at launch time and is less flexible etc. </p> <p>What I really need is a way to do the lookup and prep thumbnails lazily with separate thread or NSOperation etc, but I'm not sure what the simplest way to accomplish this would be.</p> <p>Apple's sample project LazyTableImages which is fantastic if images come from the web, could surely be adapted, although I'm having a hard time with it. Basically the problem is the same, but instead of time lag from downloading and network latency etc, my delay is just the time it takes to lookup the pictures in the user's address book. </p> <p>This is the task in my table cell subclass I need to do concurrently: </p> <pre><code> UIImage *contactImage = nil; if (ABPersonHasImageData(person)) { NSData *contactImageData = (NSData*)ABPersonCopyImageData(person); UIImage *tempContactImage = [UIImage imageWithData:contactImageData]; [contactImageData release]; UIGraphicsBeginImageContext(CGSizeMake(45.0f, 45.0f)); [tempContactImage drawInRect:CGRectMake(0.0f, 0.0f, 45.0f, 45.0f)]; contactImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); } </code></pre> <p>A big thanks to anyone who has any helpful tips or code to accomplish this in a simple and elegant way. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload