I have a page that's loading into a UIWebView (which takes 100% of the screen) on an iPad.
When I touch a text field, the page positions the text field to the right place and the keyboard starts to come up, but then it turns around and goes back down and blur is called on the input field.
When I try this same page in mobile Safari, the keyboard is able to deploy successfully.
I can't figure out what the rules are for the keyboard to show successfully and stay up = and why this is different for uiwebview than safari.
All my research on the subject has yielded no answers.
Without having any code posted in your question, I am speculating that the keyboard going back down occurs only when the HTML text field is touched prior to the final call to UIWebViewDelegate webViewDidFinishLoad:
To test this, first set your UIWebView.delegate
to the UIViewController
that owns it (or whatever object owns the UIWebView
). Then implement these delegate methods.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSString *urlString = request.URL.absoluteString;
NSLog(@"%@ with URL = %@", NSStringFromSelector(_cmd), urlString);
return YES;
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
NSString *urlString = webView.request.URL.absoluteString;
NSLog(@"%@ with URL = %@", NSStringFromSelector(_cmd), urlString);
}
Run your app and make note of the number of times that webViewDidFinishLoad:
is called. (If your web page contains multiple frames or includes things like Google Analytics, it will be called multiple times.)
Try touching the HTML text field after `webViewDidFinishLoad:' is called for the final time. Does the keyboard stay up? (I would think so).
If that works, next try to get a touch in before the final call to `webViewDidFinishLoad:'. Does the keyboard animate up but then back down?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With