Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable UITextview selection text, copy/paste UIMenuController but still have hyperlinks working [Not duplicate] [duplicate]

I want to disable copy/paste menu and i'm using HTML tag in UITextView in which multiple hyperlinks and want to only disable menu.

My texview image

enter image description here

like image 513
Umer Afzal Avatar asked Feb 20 '14 11:02

Umer Afzal


1 Answers

just try to create a subclass of UITextView that overrides the canPerformAction:withSender: method

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
    if (action == @selector(paste:))
        return NO;
    return [super canPerformAction:action withSender:sender];
}
like image 194
gunas Avatar answered Sep 30 '22 17:09

gunas