Re: Notifications on main thread
Re: Notifications on main thread
- Subject: Re: Notifications on main thread
- From: Nick Zitzmann <email@hidden>
- Date: Tue, 18 May 2010 10:58:38 -0600
On May 18, 2010, at 8:34 AM, Jonny Taylor wrote:
> - I could try acquiring the NSNotificationQueue for the main thread, but there does not appear to be a standard way of doing that. I have seen this suggested as a strategy elsewhere, but I think I have also read that one is not meant to post to queues other than that of the current thread (not sure why...).
[...]
> I feel there must be a simple way of doing what I want - can anybody advise?
There is a way to do this. You need to set up the enqueue message in an NSInvocation, have it retain the arguments, and then call the invocation's -performSelectorOnMainThread:... method to invoke the invocation on the main thread. This works any time you need to call something on the main thread, but you need to set more than one argument, or the method has arguments that take primitives instead of objects.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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