A typical call to performSelectorOnMainThread:
looks like this:
[target performSelectorOnMainThread:action withObject:foo waitUntilDone:NO];
where "result" is an argument passed to "action". A corresponding action would be:
- (void)doSomethingWithThing1:(id *)thing1
What is the correct syntax for calling an action that takes > 1 argument? Such as:
- (void)doSomethingWithThing1:(id *)thing1 andThing2(id *)thing2 andAlsoThing3(id *)thing3
[target performSelectorOnMainThread:action withObject:??? waitUntilDone:NO];
You can do it by putting your args in a dictionary or array and passing that to a special function
- (void)doStuff:(NSString *)arg1 and:(NSString *)arg2 and:(NSString *)arg3 {
...
}
- (void)doStuff:(NSArray *)argArray {
[self doStuff:[argArray objectAtIndex:0]
and:[argArray objectAtIndex:1]
and:[argArray objectAtIndex:2];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With