gpt4 book ai didi

iphone - 无法禁用 UIWebView 中的复制/定义选择菜单

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:20:52 26 4
gpt4 key购买 nike

我知道这是最常见的常见问题解答之一。事实上,我找到了以下链接:

Disabling user selection in UIWebView

但我仍然无法从菜单选择中删除副本和定义项。我只希望我的“快速”和“另一个”项目显示在菜单中。任何人都可以告诉我一种方法吗?感谢您的时间。这是我的代码和屏幕截图。

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{


if (action == @selector(quick:)) {

NSLog(@"my quick view");
return YES;

}else if (action == @selector(another:)){

NSLog(@"my another view");
return YES;

}else if (action == @selector(copy:) ||
action == @selector(paste:)||
action == @selector(cut:) ||
action == @selector(define:) )
{
return NO;
}

return [super canPerformAction:action withSender:sender];

}

enter image description here

最佳答案

首先,要解决您的问题,请将 define: 更改为 _define: 以删除相关选项。

但是,_define:是Apple私有(private)API中的一个函数(因为_),如果你想在应用商店。

但是,根据您的 copy: 选项,您的 canPerformAction 应该删除它。

仅供引用,我在这里附上了私有(private) API 函数的列表,canPerformAction 将调用这些函数:

_promptForReplace:

_showTextStyleOptions:

_define:

_addShortcut:

_accessibilitySpeak:

_accessibilitySpeakLanguageSelection:

_accessibilityPauseSpeaking:

因此,如果你想删除上面的任何功能,你必须创建一个自定义的菜单栏。下面的视频应该可以帮助您解决问题:

http://www.youtube.com/watch?v=SB7w8JEJSrc

祝你好运!

编辑:

这是您的解决方案:

-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{


if (action == @selector(quick:)) {

NSLog(@"my quick view");
return YES;

}else if (action == @selector(another:)){

NSLog(@"my another view");
return YES;

}

return NO;

}

关于iphone - 无法禁用 UIWebView 中的复制/定义选择菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18397663/

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