我正在制作一个富文本编辑器应用程序。当应用程序启动时,UIWebView加载一个包含内容可编辑div的html文件。 当我碰到一个单词时,UIWebView会显示一个菜单,显示一些单词而不是选定的单词。我怎样才能关闭这个菜单?当用户触摸某个单词时,UIWebView显示单词建议菜单
这就是我说: http://i.stack.imgur.com/Xu4A9.png
这是我的代码:
- (void)viewDidLoad
{
webText=nil;
NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
[self.editor loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]]];
self.editor.delegate=self;
[super viewDidLoad];
}
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(defineSelection:))
{
return NO;
}
else if (action == @selector(translateSelection:))
{
return NO;
}
else if (action == @selector(copy:))
{
return NO;
}
return [super canPerformAction:action withSender:sender];
}
显示我的回答 –
http://stackoverflow.com/questions/3416867/how-can-i-disable-the-spell-checker-on-text-inputs-on-the-iphone test this – Arbitur
@Arbitur我已经测试过它,并没有工作..我使用contenteditable div。不是输入或textarea。 – amone