Re: updating UI during long loop using cocoa objective-c
Re: updating UI during long loop using cocoa objective-c
- Subject: Re: updating UI during long loop using cocoa objective-c
- From: "Corey O'Connor" <email@hidden>
- Date: Sat, 31 Mar 2007 22:12:15 -0700
On 3/31/07, Jerry Krinock <email@hidden> wrote:
On 2007 Mar, 31, at 20:45, I. Savant wrote:
Allow me to return some good advice someone gave me a few weeks ago:
Before you delve into multithreading, consider running your window as
a "modal session". Poorly documented, no sample code, but simple if
you can get it to work. Start by reading the documentation for:
-[NSApplication beginModalSessionForWindow:]
It's really weird because the NSModalSession is a struct, but just go
along with it. Another hint: Use the strangely-named method:
-runModalSession:
when you want to update your view.
I think, though I haven't tried, a similar effect can be had by sendign the
runUntilDate message to the application thread's run loop. If you pass in a
date that is a suitable short time from now, say 1/60th of a second, I think
that allows the UI to be updated and prevents the spinning wheel o' death.
YMMV though: Never tried it; just infered from the documentation. Couldn't
find the one that reviewed the cocoa event system though.
--
-Corey O'Connor
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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