Re: Blocking loops
Re: Blocking loops
- Subject: Re: Blocking loops
- From: Nicko van Someren <email@hidden>
- Date: Fri, 16 Jun 2006 15:41:39 +0100
On 16 Jun 2006, at 14:24, email@hidden wrote:
I've got an application that does a fair bit of processing in a
while loop...
...
Unfortunately, the progress bar doesn't actually move (and the App is
unresponsive) until the loop completes.
There are two problems here. One is that the progress bar does not
move; you can probably fix this by calling [progressBar display] to
force the a redraw. The second problem is that your application has
become unresponsive, which may still be a concern even if the
progress bar lets the user know something is happening. In this case
you might want to consider either moving the whole process to another
thread or, given that you're looking at processing a large batch of
objects, processing the objects one at a time by writing a method to
be called back using something like
performSelector:withObject:afterDelay: In this case you could pass
the enumeration object in to your selector with a delay of 0.0 and
have the method trigger another call to itself if it managed to pull
anything out of the enumeration this time around.
Nicko
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden