OGeek|极客世界-中国程序员成长平台

标题: ios - 在 objective-c 中选择文本时,如何防止出现复制按钮? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 08:06
标题: ios - 在 objective-c 中选择文本时,如何防止出现复制按钮?

我不希望在选择文本时出现“复制/定义”按钮。 我如何在 objective-c 中做到这一点?

更新:我想在 UIWebView 中这样做



Best Answer-推荐答案


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)canPerformActionSEL)action withSenderid)sender
{
    if (action == @selector(paste)
        return NO;
    return [super canPerformAction:action withSender:sender];
}

另见 UIResponder

从这个 question 回答发表者rpetrich

关于ios - 在 objective-c 中选择文本时,如何防止出现复制按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30876386/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4