ios - 在 objective-c 中选择文本时,如何防止出现复制按钮?
<p><p>我不希望在选择文本时出现“复制/定义”按钮。
我如何在 objective-c中做到这一点?</p>
<p><strong>更新</strong>:我想在 UIWebView 中这样做</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><blockquote>
<p>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:</p>
</blockquote>
<pre><code>- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(paste:))
return NO;
return ;
}
</code></pre>
<p>另见 <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIResponder_Class/index.html" rel="noreferrer noopener nofollow">UIResponder</a> </p>
<p>从这个 <a href="https://stackoverflow.com/questions/1426731/how-disable-copy-cut-select-select-all-in-uitextview" rel="noreferrer noopener nofollow">question</a> 回答发表者<a href="https://stackoverflow.com/users/4007/rpetrich" rel="noreferrer noopener nofollow">rpetrich</a> </p></p>
<p style="font-size: 20px;">关于ios - 在 objective-c中选择文本时,如何防止出现复制按钮?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/30876386/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/30876386/
</a>
</p>
页:
[1]