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

NSGod
- 22,699
- 3
- 58
- 66

Andrew Chang
- 1,289
- 1
- 18
- 38
1 Answers
-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];
}
-
6I am using NSTextField (for OS X) instead of UITextField (for iOS). There is no such method in NSTextField. – Andrew Chang May 14 '13 at 12:24