I have a strange issue with UIGestureRecognizer
I've create a class where i declare the gesture recognizer, and put self as a target
-(id)initWithTextView:(UITextView*)theTextView withDelegate:(id<WordSelectionDelegate>)theDelegate
{
if (self = [super init])
{
delegate = theDelegate;
textView = theTextView;
// init long press gesture to detect pressing on text elements
UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressFromSender:)];
[textView addGestureRecognizer:longPressGesture];
}
return self;
}
But the trick is when i actually make a long press gesture i have next error:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMutableAttributedString handleLongPressFromSender:]: unrecognized selector sent to instance 0x76227b0'
Why does the messages to self goes to String???
handleLongPressFromSender
and make sure it's getting called (if not, is theWordSelection
object falling out of scope and getting released on you? or did you type the method name incorrectly? or does that method which only takes one parameter not have the right parameter type?). If it is getting called, then broaden the search again and take a look at yourWordSelectionDelegate
definition and make sure you don't have an issue there. – Rob