1

How to enable hidden keyboard programmatically (xcode uiwebview) if web-page without text-inputs, only hidden javascript inputs. i need receive data (not manually) but from scanner to javascript inputs. there no problem with ios6, but don't works with ios7.

i use standard uiwebview webpage loading

NSURL *websiteUrl = [NSURL URLWithString:@"http://google.com"];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:websiteUrl];
[mypage loadRequest:urlRequest];
rmaddy
  • 314,917
  • 42
  • 532
  • 579
aronsimt
  • 25
  • 10
  • http://stackoverflow.com/questions/9779477/programmatically-display-keyboard-in-uiwebview, http://stackoverflow.com/questions/13002376/show-keyboard-automatically-with-focus-event-in-uiwebview-using-trigger-io-pho – Popeye Feb 12 '14 at 20:59

1 Answers1

0

Use the -becomeFirstResponder method on a UITextField to make the keyboard pop up.

e.g.:

[textField becomeFirstResponder];
Alexandre Cassagne
  • 2,384
  • 23
  • 40
  • i dont have UITextField, just uiwebview – aronsimt Feb 12 '14 at 20:52
  • In Apple's documentation, you will see that you may not use a `UIKeyboard` without having a text field. It might be possible – I don't know. But Apple will not allow the app in the store. Read the guidelines : https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/ – Alexandre Cassagne Feb 12 '14 at 20:53
  • @AlexandreCassagne How do you expect to enter information to input fields in a UIWebView? – Popeye Feb 12 '14 at 20:56
  • i have javascript input field, with ios6 it works, but with ios7 not works – aronsimt Feb 12 '14 at 20:57
  • @Popeye What do you think the text fields in a web view are ? How do you think iOS renders them ? They are `UITextField`s. As for you @user3303340 : once again, using private APIs may very easily break from one version to another. I'm sorry to say this – but what you were doing, even if some people do it, is something you are not supposed to. You should find another way to do so. You may not access UIKeyboard according to the docs – that's just the way it is. Read. – Alexandre Cassagne Feb 12 '14 at 21:25
  • i just have simple problem, i have javascript inputs on web-site. i have load website in my app (uiwebview) and keyboard not detect javascript input (with html or php keyboard works) – aronsimt Feb 12 '14 at 21:32
  • 1
    Where in any documentation does it state that a html input field is rendered as a `UITextField`? A html input field is completely different from a `UITextField`. -1 – Popeye Feb 12 '14 at 21:35
  • Arguing about what is a UITextfield aside, it is the right way to bring up the keyboard. You can leave it entirely outside the screen or behind some other view and you will still get a keyboard on becomeFirstResponder. You can get text out of it and do whatever you like. I wrote a VT terminal app with this trick. – Adam Eberbach Feb 12 '14 at 21:40
  • Adam Eberbach thank you, how i can detect external keyboard keypress on uiwebview? – aronsimt Feb 12 '14 at 21:46
  • Have you thought about adding a tap gesture recognizer? It's hack but if your field gives you no event you might need to get the tap from anywhere on screen and then see if it falls within the rect you care about. – Adam Eberbach Feb 12 '14 at 21:49