gpt4 book ai didi

ios - 在 objective-c 中选择文本时,如何防止出现复制按钮?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:14:51 29 4
gpt4 key购买 nike

我不希望在选择文本时出现“复制/定义”按钮。我怎样才能在 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

来自这个 question 的答案发布者 rpetrich

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

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com