toxicsoftware.com

RANDOMIZE USR 0

toxicsoftware.com header image 4

Grab that Invocation

June 23rd, 2006 · 3 Comments · Default

CInvocationGrabber is a Cocoa class to help with creating NSInvocation objects.

NSInvocation objects are Cocoa’s equivalent of “functors” and are extremely handy. But unfortunately creating them is often a pain. For example, take the following code showing how to create a simple NSInvocation:

NSInvocation *theInvocation = [NSInvocation invocationWithMethodSignature:[theString methodSignatureForSelector:@selector(insertString:atIndex:)]]; [theInvocation setSelector:@selector(insertString:atIndex:)]; [theInvocation setTarget:theString]; NSString *theFirstArgument = "Hello World"; [theInvocation setArgument:&theFirstArgument atIndex:2]; unsigned [...]

[Read more →]

Tags:··