Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between [self MethodName] and [self performSelector:@selector(Method Name)]

What is the difference between calling the methods with following types

1.

[self methodName];

and

2.

[self performSelector:@selector(methodName)];   // no afterDelay is used

Is it like performSelector will use different thread to work??

like image 453
DShah Avatar asked Feb 02 '23 13:02

DShah


1 Answers

In most cases, they are equivalent.

According to the documentation, the purpose of the performSelector: variant is so that you can call methods that are defined dynamically and not actually present at compile-time. That's all. For calling a method that is present at compile-time, there is no difference between the two.

like image 172
aroth Avatar answered Feb 12 '23 11:02

aroth