I don't want the Copy / Define button to appear when select a text. How can i do that in objective c ?
UPDATE: i want to do that in UIWebView
I don't want the Copy / Define button to appear when select a text. How can i do that in objective c ?
UPDATE: i want to do that in UIWebView
The easiest way to disable pasteboard operations is to create a subclass of UITextView that overrides the canPerformAction:withSender: method to return NO for actions that you don't want to allow:
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(paste:))
return NO;
return [super canPerformAction:action withSender:sender];
}
Also see UIResponder
Here are all actions sent to `canPerformAction:withSender:
cut:
copy:
select:
selectAll:
paste:
delete:
_promptForReplace:
_transliterateChinese:
_showTextStyleOptions:
_define:
_addShortcut:
_accessibilitySpeak:
_accessibilitySpeakLanguageSelection:
_accessibilityPauseSpeaking:
makeTextWritingDirectionRightToLeft:
makeTextWritingDirectionLeftToRight:
so what you need to remove Copy/Define is the following
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if (action == @selector(copy:))
return NO;
if (action == @selector(_define:))
return NO;
return [super canPerformAction:action withSender:sender];
}