如何禁止
如标题所示。
NSTextField
和NSSecureTextField
的复制(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];
}