Hide keyboard in UIWebView

后端 未结 2 489
孤独总比滥情好
孤独总比滥情好 2021-02-04 22:09

Is there a way to make a UIWebView dismiss all associated input controls, such as keyboards/pickers?

相关标签:
2条回答
  • 2021-02-04 22:30
        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 ;)

    0 讨论(0)
  • 2021-02-04 22:33

    Haven't tried it in a web view with a picker, but this definitely works to dismiss the keyboard:

    [theWebView endEditing:YES];
    
    0 讨论(0)
提交回复
热议问题