iphone - 如何禁用弹出菜单项,如选择、全选、建议...、定义(在 UIWebView 上)?

标签 iphone ios uiwebview uiapplication uiresponder

如何禁用弹出菜单项,例如选择全选建议...定义 (在 UIWebView) 上?

我在帮助上找到了以下信息,但不明白如何使用:

For the editing menu commands, this is the shared UIApplication object. Depending on the context, you can query the sender for information to help you determine whether a command should be enabled.

最佳答案

调整以下方法:

#import "NSObject+myCanPerformAction.h"

@implementation NSObject (myCanPerformAction)

- (BOOL)myCanPerformAction:(SEL)action withSender:(id)sender {
    if (action == @selector(copy:)) {
        return [self myCanPerformAction:action withSender:sender]; // not a recursion
    }
    if (action == @selector(paste:)) {
        return [self myCanPerformAction:action withSender:sender]; // not a recursion
    }
    return NO;
}

@end

混合:

[[UIWebDocumentView class] jr_swizzleMethod:@selector(canPerformAction:withSender:) withMethod:@selector(myCanPerformAction:withSender:) error:nil];

关于iphone - 如何禁用弹出菜单项,如选择、全选、建议...、定义(在 UIWebView 上)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13233613/

相关文章:

iphone - 为什么我不能为 Core Plot 构建 SDK?

ios - 如何在 Objective-C 中将单斜杠 "\"替换为 "\\\"

iphone - ipad相机和webview youtube视频播放问题

ios - 下拉样式UIPickerView?

ios - Swift:在 SceneView 之上设置 View 不起作用

javascript - 如何在 UIWebView 上运行 HTML+javascript 文件。 .?

ipad - iOS 11 UIWebView 下拉菜单在 iPad 上完全损坏 - UIPopoverController

ios - 无法在 ViewController 的 AppDelegate 中使用数组

iphone - ABPeoplePicker 选择许多并返回电子邮件数组

ios - UICollectionView 仅针对手机将单元格置于横向居中