Iphone 我可以禁止键盘在UIWebView中显示吗?
当在UIWebView中选择网页元素时,是否可以禁用键盘显示?注册键盘通知:Iphone 我可以禁止键盘在UIWebView中显示吗?,iphone,objective-c,ipad,uiwebview,Iphone,Objective C,Ipad,Uiwebview,当在UIWebView中选择网页元素时,是否可以禁用键盘显示?注册键盘通知: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow) name:UIKeyboardWillShowNotification object:nil]; 然后,您可以通过在keyboardWillShow中放置以下代码来阻止它显示: UITextField *dummyTextField =
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow) name:UIKeyboardWillShowNotification object:nil];
然后,您可以通过在keyboardWillShow中放置以下代码来阻止它显示:
UITextField *dummyTextField = etc.
//Basically, create a dummy uitextfield that you never show.
//I can't remember all the syntax :)
[dummyTextField becomeFirstResponder];
[dummyTextField resignFirstResponder];
//Keyboard should be gone. Hoorah!
不确定这是否100%可以正常工作。如果键盘开始设置动画,然后再次隐藏,则可以使用
[UIView enableAnimations:NO];
如果键盘不喜欢在显示时退出,那么可以尝试将虚拟文本字段的inputView属性改为某个虚拟UIView
希望这能让你有所收获 注册键盘通知:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow) name:UIKeyboardWillShowNotification object:nil];
然后,您可以通过在keyboardWillShow中放置以下代码来阻止它显示:
UITextField *dummyTextField = etc.
//Basically, create a dummy uitextfield that you never show.
//I can't remember all the syntax :)
[dummyTextField becomeFirstResponder];
[dummyTextField resignFirstResponder];
//Keyboard should be gone. Hoorah!
不确定这是否100%可以正常工作。如果键盘开始设置动画,然后再次隐藏,则可以使用
[UIView enableAnimations:NO];
如果键盘不喜欢在显示时退出,那么可以尝试将虚拟文本字段的inputView属性改为某个虚拟UIView
希望这能让你有所收获 我尝试使用虚拟文本字段和UIView,但它不起作用(iOS9)。对我有效的方法是调用webView.endEditing(true)。请看,我尝试使用虚拟文本字段和UIView,但它不起作用(iOS9)。对我有效的方法是调用webView.endEditing(true)。看见