如何禁止NSTextField的复制粘贴操作



如标题所示。

如何禁止NSTextFieldNSSecureTextField的复制(Command + C)和粘贴(Command + V)操作?

创建UITextField的子类。在这个子类中,实现

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
    if (sel_isEqual(action, @selector(copy:))) {
        return NO;
    }
    return [super canPerformAction:action withSender:sender];
}

最新更新