如何禁用popup菜单项像select,全选,build议…,定义(在UIWebView)?
如何禁用popup菜单项像select , 全选 , build议… , 定义 (在UIWebView
)?
我find了关于帮助的下列信息,但不知道如何使用它:
对于编辑菜单命令,这是共享的UIApplication对象。 根据上下文,您可以查询发件人的信息,以帮助您确定是否应启用命令。
调用以下方法:
#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];