我需要在单击按钮时打开键盘,同时显示光标在 UIWebview 上的早期位置。我对java脚本完全陌生。这是我的代码
- (IBAction)keyboardButtonSelected:(id)sender {
NSString *jScriptString = [NSString stringWithFormat:@"getCurrentCursor"];
[webViewForEditing stringByEvaluatingJavaScriptFromString:jScriptString];
[keyboardButton setSelected:YES];
[keyboardButton setImage:[UIImage imageNamed:@"keyboard-light"] forState:UIControlStateSelected];
[viewForHomeEmoji removeFromSuperview];
}
我在脚本中写了方法:
function getCurrentCursor
{
document.getElementById('content').focus();
}
<body>
<div id="content" contenteditable="true" style="font-family: Helvetica">This is out Rich Text Editing View </div>
</body>
指导我为实现这一目标需要写什么。任何能让我熟悉 java 脚本与 Objective-C 组合的教程。引导我