简体   繁体   中英

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??

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM