Simular tocar el botón Listo

I have a UIWebView and when I have the keyboard up after entering in data, I want to be able to programmatically dismiss the keyboard, and hit the return key to load the next page. Is there anyway to do this?

Some Ideas: • Faking a tap on the Done Button • Sending a Carriage return via JavaScript

I have tried these but haven't been successful.

preguntado el 08 de noviembre de 11 a las 16:11

Is the done button in UIWebView or not? -

2 Respuestas

Tal vez puedas usar el [UIWebView stringByEvaluatingJavaScriptFromString] method to achieve it.

You can use the above method to exec a javascript, the script can be a submit form command. Here is some example:

NSString js = @"document.forms[0].submit()";
[self.webview stringByEvaluatingJavaScriptFromString:js];

Espero eso ayude.

Respondido 04 Abr '12, 12:04

Have you tried the usual truco for hiding a keyboard?

Tu podrías intentar resignFirstResponder on the webview.

contestado el 23 de mayo de 17 a las 14:05

yes, but I need to submit the web form, like the done button in the UIWebView does. - Matthew Knippen

a simple form submit will not work either, because it is not always a form. It needs to simulate the exact code that the done button does within the web view. - Matthew Knippen

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.