Reputation: 28248
I have a UIWebView that loads and external product configuration web service UI that is basically a bunch of dependent Drop Down lists.
The problem is the Drop Downs are basically enhanced text input's so when the user taps them to display the options the UIKeyboard keeps popping up and own after they make their selection. it is less than a fluid process. Is there anyway to suppress the html inputs from triggering the UIKeyboard?
Upvotes: 2
Views: 2550
Reputation: 1691
Then try this:
...
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeKeyBoard:) name:UIKeyboardDidShowNotification object:nil];
...
- (void)removeKeyBoard:(NSNotification *)notify {
// web is your UIWebView
[web stringByEvaluatingJavaScriptFromString:@"document.activeElement.blur()"];
}
remember to remove the notification and can filter it if only for your WebView object.
Upvotes: 3
Reputation: 1691
Try using the following code in the HTML:
<input type='text' width='100' onclick='blur()'>
with the method blur () and then you lose the focus will not appear on the keyboard.
Upvotes: 0