Re: updating NSView on separate thread
Re: updating NSView on separate thread
- Subject: Re: updating NSView on separate thread
- From: Jens Alfke <email@hidden>
- Date: Sun, 31 Jan 2010 21:44:19 -0800
On Jan 31, 2010, at 9:13 PM, Patrick Cusack wrote:
> What I want to do is this: display a spinning icon in a transparent overlay window (I can do this no problem) while my program is saving, printing PDFs, etc. These methods as typically defined in NSDocument do not have areas where you can inject a call to update a progress bar. I'm thinking about - (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError . I want to draw a circular-spinning-progress-ish indicator on a transparent window so that the user understands why the UI is temporarily locked when these methods are being called. Am I fitting a round peg in a square whole?
Yes :). If there's an operation that blocks for a long time, you should run it on a background thread so the UI remains responsive, instead of running it on the main thread and trying to update the UI in the background. Look into using NSOperation (or dispatch queues on 10.6).
—Jens_______________________________________________
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