Sar*_*rah 2 iphone cocoa-touch objective-c uiwebview uitextfield
我正在UIWebview上打开一个网页,这个页面有一个文本字段和一个虚拟键盘输入密码.但是当编辑文本字段时,iPhone虚拟键盘也会出现.我想解雇iPhone键盘并同时继续编辑文本字段.我尝试过以下但是没有用.
[webView stringByEvaluatingJavaScriptFromString:@"document.activeElement.blur()"];
Run Code Online (Sandbox Code Playgroud)
并且还尝试注册键盘通知,这样我就可以调低键盘,但没有成功.我很感激有关如何实现这一目标的任何想法.提前致谢.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector (keyboardDidShow:)
name: UIKeyboardDidShowNotification object:nil];
-(void) keyboardDidShow: (NSNotification *)notif
{
// I want to dismiss the keyboard
}
Run Code Online (Sandbox Code Playgroud)
试试这个
[webView endEditing:YES]
Run Code Online (Sandbox Code Playgroud)
如果以上解决方案不起作用,您也可以尝试此链接 - 在UIwebView中隐藏键盘