我不希望在选择文本时出现“复制/定义”按钮。 我怎样才能在 objective-c 中做到这一点?
更新:我想在 UIWebView 中执行此操作
最佳答案
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];
}
另见 UIResponder
关于ios - 在 objective-c 中选择文本时,如何防止出现复制按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30876386/