d) doesn't work - I tried that one, in this case it's a UIView and invalidating
it, or a tool bar on it, doesn't get the tool bar buttons to redraw properly,
hence the need to move the actual set of those things over to the main thread.
Whether it works for other UI elements I don't know but it
On 22/08/2010, at 6:31 PM, Graham Cox wrote:
> the hidden parameter -cmd to any method is its own selector
That should be _cmd (slip of the shift key).
So you could create an NSInvocation for the current method using [NSInvocation
invocationWithMethodSignature:[self methodSignatureForSelector
On 22/08/2010, at 7:03 AM, Roland King wrote:
> if( ![ NSThread isMainThread ] )
> [ NSMagicFunctionReturningAnInvocationForThisCurrentFunction()
> performSelectorOnMainThread:@selector( invoke ) withObject:nil
> waitUntilDone:NO ];
> else
> {
> // method performing code here
> }
>
use blocks and gcd, or use a proxy
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSProxy_Class/Reference/Reference.html
A proxy can forward all invocations to the main thread. Create a subclass of
NSProxy. Implement
– (void)forwardInvocation:(NSInvoc
Use GCD.
dispatch_sync(dispatch_get_main_queue(), ^{
// Call your function here
MyFunction (param 1, param2, ...);
});
Tony Romano
http://www.cocoaegghead.com
On Aug 21, 2010, at 10:03 PM, Roland King wrote:
Is there a built-
Is there a built-in function to make an NSMethodInvocation from 'the current
method I'm in with all current parameters', or does anyone have any code
they've written to do this?
Motivation, I'm writing a display class which can get updated from a background
thread, it has a whole load of metho