Is there a way to make a UIWebView dismiss all associated input controls, such as keyboards/pickers?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Haven't tried it in a web view with a picker, but this definitely works to dismiss the keyboard:
[theWebView endEditing:YES];
回答2:
for (UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows])
for (UIView *keyboard in [keyboardWindow subviews])
if([[keyboard description] hasPrefix:@"<UIFormAssistant"] == YES)
{
[keyboard removeFromSuperview];
}
Dirty way but it works ;)