Total Objective-C / Cocoa Touch noob here, beware.
I'm trying to intercept when a user long presses on a UITextView (a magnifying glass then appears with the caret positioner) and then releases the touch, i.e. when normally the "Select" and "Select All" Options appear, after the magnifying glass. I want to replace this with my own custom action that is then performed.
Is this possible?
You can try something like this:
Disable the built-in long press recognizer
for (UIGestureRecognizer *recognizer in textView.gestureRecognizers) {
if ([recognizer isKindOfClass:[UILongPressGestureRecognizer class]]){
recognizer.enabled = NO;
}
}
Then add your own
UILongPressGestureRecognizer *myLongPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:<your target> action:@selector(<your custom handler>)];
[textView addGestureRecognizer:myLongPressRecognizer];
[myLongPressRecognizer release];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With