1

如何禁用弹出菜单项,如SelectSelect AllSuggest...Define (on UIWebView)?

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

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

4

1 回答 1

1

调配以下方法:

#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];
于 2012-11-05T16:40:46.743 回答