Re: How hidden the Keyboard in a UIWebView
Re: How hidden the Keyboard in a UIWebView
- Subject: Re: How hidden the Keyboard in a UIWebView
- From: Rodrigo Zanatta Silva <email@hidden>
- Date: Wed, 23 Mar 2011 15:25:14 -0300
Hi, sorry for this delay, I had to solve another thing. The reason of WHY i
am trying do this is because my boss say: DO IT!! Lol. I am doing a "User
Manager" so the user will not need to write in the keyboard and the system
will record the user name.
The UIWebView has a bad integration with keyboard and Java Script. And i
can't control the keyboard at all, I can only listen what it will do.
Ok, you give-me a start point. What I tried was:
- [myWebView
stringByEvaluatingJavaScriptFromString:@"document.getElementsByName(myname)[0].onclick
= function onclick(event){document.getElementsByName(myname)[0].blur();};"
Result: FAIL!! why? Because the cocoa first start to show the keyboard than
it will execute the JavaScript code. So, in the middle of animation, it run
and the keyboard return the animation and go out. I don't want it even start
to show.
The second way:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification object:nil];
- (void)esconde {
for (UIWindow *keyboardWindow in [[UIApplication sharedApplication]
windows])
for (UIView *keyboard in [keyboardWindow subviews])
if([[keyboard description] hasPrefix:@"<UIPeripheralHostView"]
== YES) [keyboard removeFromSuperview];
}
- (void)keyboardWillShow:(NSNotification *)aNotification {
[self performSelector:@selector(esconde) withObject:nil afterDelay:0];
}
Result: Well, work... But... It show the very start of the animation, but
the keyboard don't show. See that I NEED some delay, because this I use the
performSelector. I don't need more delay than the use of this way. If I use
the function directly, the "UIPeripheralHostView" will not exist. This way
is little dirty...
The problem to automatic focus a text box (it work) and than show the
keyboard isn't working.
How can I use the comand [keyboard showForFocusedTextBox]. Any more idea to
control the keyboard?
2011/3/15 Conrad Shultz <email@hidden>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 3/15/11 7:09 AM, Rodrigo Zanatta Silva wrote:
> > Anyone have any idea? I am stuck... It's easy do this with
> > UITextView, but the text field in a web page have less control. I
> > really need a new idea, please, anyone give-me a idea??!?!?
>
> Please be patient. If no one responds, it's probably because they don't
> have an idea either.
>
Lol.. I have to try..
>
> > 2011/3/14 Rodrigo Zanatta Silva <email@hidden>
> >
> >> I searched a lot, and all thing that hidden the keyboard is when
> >> you are in a UITextField.
> >>
> >> This is the problem. I am in a UIWebView and the user click in a
> >> text box in the web page, so the iOS open the keyboard. I can know
> >> when the keyboard will show by the UIKeyboardWillShowNotification.
> >> But, I want to show another screen instead the keyboard.
>
> Try not using a UIWebView? This whole scheme sounds a bit fishy to
> me... if you are interfacing with a web service, for example, you should
> probably implement a native UI and use XML, JSON, etc. to talk the the
> site.
>
> I do know that there are some reasons you would want to do this, such as
> displaying a keypad for numeric entry. This _ought_ to be handled with
> XHTML's inputmode attribute, which MobileSafari doesn't support.
>
> For any Apple engineers out there, I filed a bug a long time ago on
> this... rdar://6404093
>
> >> How can I hidden, or never show the keyboard. If the people cancel
> >> my screen, than I want to keyboard appear. There are any class that
> >> I can manager the keyboard? How can I do this:
> >>
> >> *[keyboard goWay]* and
> >>
> >> *[keyboard show]*
>
> I have no special insights on this, but you might check out
>
> http://stackoverflow.com/questions/792035/how-do-i-cancel-a-text-field-edit-in-a-uiwebview
>
> This purports to let you lose the keyboard via defocusing in JavaScript.
> You would then probably need to present your own view for input on top
> of/next to the UIWebView and write controller code to send it into the
> UIWebView.
>
> Also see
>
> http://stackoverflow.com/questions/2749486/fill-uiwebview-textinput-with-custom-keyboard
>
> Sounds like a huge headache to me, though, and again I question the
> wisdom of what you are trying to do. Perhaps you can elaborate on WHY
> you need to this and someone on the list might offer a more robust and
> probably simpler solution.
>
> - --
> Conrad Shultz
>
> Synthetiq Solutions
> www.synthetiqsolutions.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iD8DBQFNf9TMaOlrz5+0JdURAmJ3AJ0bBHozwjR4gboflOeyvJ3lBpXotgCeLC/y
> pvvZ3U04Qt956lkho/e6Tmw=
> =nZnY
> -----END PGP SIGNATURE-----
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden