1

As the title mentions. How can I forbid the copy (Command + C) and paste (Command + V) operations in an NSTextField or NSSecureTextField?

NSGod
  • 22,699
  • 3
  • 58
  • 66
Andrew Chang
  • 1,289
  • 1
  • 18
  • 38

1 Answers1

-4

Create a subclass of UITextField. In that subclass, implement

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
    if (sel_isEqual(action, @selector(copy:))) {
        return NO;
    }
    return [super canPerformAction:action withSender:sender];
}
gaige
  • 17,263
  • 6
  • 57
  • 68
prince
  • 854
  • 2
  • 9
  • 36