performSelector苹果官方文档的介绍
先看官方文档的Quick Help,逐字翻译后,后面会有代码对这些令人boring的文档进行解释:
- Declaration: - (id)performSelector:(SEL)aSelector;
- Description: Sends a specified message to the receiver and returns the result of the message.
-
向接收方发送指定的消息,并返回消息的结果
这个方法相当于直接向接收方发送aSelector消息。
For example, the following messages all do the same thing:
Listing 1
id aClone = [anObject copy];
id aClone = [anObject performSelector:@selector(copy)];
id aClone = [anObject performSelector:sel_getUid("copy")];
The performSelector: method allows you to send messages