What is the role of performSelector?
Comparing:
[self btnClicked];
and
[self performSelector:@selector(btnClicked)];
-(void)btnClicked
{
NSLog(@"Method Called");
}
both are woking fine for me. What is difference between these two. [self btnClicked]
and [self performSelector:@selector(btnClicked)]
;
The two are pretty identical when used as you have demonstrated, but the latter has the advantage that you can dynamically determine which selector to call at runtime.
SEL selector = [self gimmeASelectorToCall];
[self performSelector: selector];