tags:

views:

70

answers:

2

Example: I have a selector like this, which I give to another method as parameter:

SEL mySelector = @selector(doSomething:);

I would like to call that doSomething method now inside that method.

Background: I have an method that performs some core animation actions. It uses already the didStopSelector, which calls an special memory management method when everything is done. But then, I want to be able to call a simple method that takes no special parameters, to do some stuff afterwards. But that method shall not be responsible for calling the memory management method, so I need to fire an selector that I store in an ivar, for example.

+7  A: 
[receivingObject performSelector:mySelector withObject:someParam];

There's a version without withObject if your selector doesn't take any parameters. See the docs for NSObject.

Marc W
great! thanks very much!
Thanks
+2  A: 

You can call NSObject's performSelector methods:

- (id)performSelector:(SEL)aSelector withObject:(id)object;
- (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;
Naaff