Hi folks

I want to store a "method pointer" in a dictionary, recover it and call it from 
elsewhere in code.

So, I have code like this to store the "method pointer":

{
  IMP anIMP = [anObject methodForSelector:@selector( myMethod: )];

  [myDictionary setObject:anIMP forKey:myKey];
}

… and then, elsewhere, I want to recover the IMP from the dictionary and invoke 
the selector on the "self" object that is held in the IMP.

Or have I misunderstood what IMPs do?

In C#, a delegate knows about the "this", upon which the method will be called, 
within itself and can simply be called without having to go through any 
gymnastics to get the target object. Isn't this what IMPs do?

TIA

Joanna

--
Joanna Carter
Carter Consulting

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to