How disable Copy, Cut, Select, Select All in UITextView

ios, objective-c, uitextview

Solution

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

Problem

The `UITextView`'s Copy, Cut, Select, Select All functionality is shown by default when I press down on the screen. But, in my project the `UITextField` is only read only. I do not require this functionality. Please tell me how to disable this feature.

Original source

Related problems