如何禁用弹出菜单项,如选择,全选,建议...,定义(在UIWebView上)? [英] How to disable popup menu items like Select, Select All, Suggest..., Define (on UIWebView)?

查看:98
本文介绍了如何禁用弹出菜单项,如选择,全选,建议...,定义(在UIWebView上)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How to disable popup menu items like Select, Select All, Suggest..., Define (on UIWebView)?

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

I have found the following information on the help but don't understand how to use it:


对于编辑菜单命令,这是共享的 UIApplication
对象。根据上下文,您可以向发件人查询
信息,以帮助您确定是否应启用命令。

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.


推荐答案

Swizzle以下方法:

Swizzle the following method:

#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

Swizzling:

Swizzling:

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

这篇关于如何禁用弹出菜单项,如选择,全选,建议...,定义(在UIWebView上)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆