Re: UITable Views and display lags
Re: UITable Views and display lags
- Subject: Re: UITable Views and display lags
- From: Jack Carbaugh <email@hidden>
- Date: Sun, 21 Mar 2010 13:25:30 -0400
You don't need to overcomplicate downloading the images with an
NSOperation.
In my experience, downloading asynchronously with an NSURLConnection
and the delegate methods works far better.
Jack
On Mar 21, 2010, at 12:52 PM, Matt Neuburg wrote:
On Fri, 19 Mar 2010 18:55:12 +0100, WT <email@hidden> said:
On Mar 19, 2010, at 6:40 PM, Michael Davey wrote:
OK, so I have changed the code to show a placeholder image, but I
am a little
uncertain as to how to fetch the images asynchronously. I could
start a
background thread with performSelectorInBackground, but am concerned
that this
would spawn far too many threads - does anyone have any suggestions?
You might want to use an NSOperationQueue. Define NSOperation
instances, each
fetching one or more images. For each fetching NSOperation you
define, you
should also define a "cleanup" NSOperation, dependent on its
associated fetching
one, so that when the fetching one ends, the cleanup one then swaps
the
placeholder image out and the fetched images in. Make sure, though,
that this
swap happens in the main thread, meaning that the cleanup
NSOperation should
invoke a -performSelectorInMainThread method, rather than access the
UI
directly.
I'm just curious: Why is it better to have a fetching NSOperation
and a
cleanup NSOperation dependent on it, rather than a single
NSOperation that
fetches and then tells the main thread to show the image? m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden