What is the role of performSelector?
Comparing:
[self btnClicked];
and
[self performSelector:@selector(btn
Apple doc is your friend.
NSObject Protocol Reference
It
Sends a specified message to the receiver and returns the result of the message.
In particular:
The
performSelector:
method is equivalent to sending an aSelector message directly to the receiver. For example, all three of the following messages do the same thing:id myClone = [anObject copy]; id myClone = [anObject performSelector:@selector(copy)]; id myClone = [anObject performSelector:sel_getUid("copy")];
However, the performSelector: method allows you to send messages that aren’t determined until runtime. A variable selector can be passed as the argument:
SEL myMethod = findTheAppropriateSelectorForTheCurrentSituation(); [anObject performSelector:myMethod];
The aSelector argument should identify a method that takes no arguments. For methods that return anything other than an object, use NSInvocation.
Hope that helps.