Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用 UIWebView 创建了富文本编辑器。我想在不点击 uiwebview 的情况下显示键盘,这意味着当我打开编辑器时键盘应该打开并且 uiwebview 应该是可编辑的。
只需编写此委托方法:
- (void)webViewDidFinishLoad:(UIWebView *)webView { webView.keyboardDisplayRequiresUserAction = NO; [webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('content').focus()"];
}
content 是元素的id。