2

我已经在 Webview 中加载了 html 并使其可编辑。

NSString *htmlStrToShow = [NSString stringWithFormat:@"<body contenteditable =\"true\">%@</body>",htmlStrToShow];
[self.webView loadHTMLString:htmlStrToShow baseURL:nil];

我也用过,

 [_webView stringByEvaluatingJavaScriptFromString:@" document.body.contentEditable =\"true\"; document.designMode=\"on\";"]; 

但是当我尝试编辑时显示键盘但光标丢失并且无法编辑。代码在 IOS6 中工作正常,但在 IOS 7 中不工作。

4

1 回答 1

0

我有同样的问题。在我的情况下,解决方案是将 UIWebView 的框架高度降低到类似 safari 的高度。

于 2013-10-23T11:10:01.300 回答