Reputation: 320
I want to perform the method which has a few arguments. Is there any easy way to pass a few of them at once? Something like
[self performSelector:@selector(methodName) withObject:firstParameter withObject:secondParameter afterDelay:0.1];
I've found a way here SEL performSelector and arguments, but it seems a little bit complicated and I guess there should be some easier way to make it done. But probably it just looks like that to me because of being newbie in Objective C :)
I'll appreciate your help a lot!
Upvotes: 2
Views: 490
Reputation: 4117
Or another solution:
#import <objc/runtime.h>
...
objc_msgSend(self, sel_getUid("methodwithFirstParam:secondParam:thirdParam:"), @"foo", "bar", 42 );
Unlike performSelector:
, method objc_msgSend
can take a lot of parameters with different types, like NSObject
(and child classes) or BOOL
, int
, char*
etc.
Upvotes: 3
Reputation: 29767
Upvotes: 3