It may be useful to know how to do this if you cannot use performSelector, perhaps because the selector string should be used in the protocol method:
To enable parameters that support the selector, it should be specified as follows:
NSString *stringForSelector = @"doSomethingAwesome:";
Suppose we handle tap
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:NSSelectorFromString(stringForSelector)];
The UIGestureRecognizer class allows the recognizer to be used in the action callback:
- (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer;
So, to do something amazing on Tap, we could write:
- (void)doSomethingAwesome:(UITapGestureRecognizer *)tapGesture {
source share