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: Laurent Daudelin <email@hidden>
- Date: Wed, 23 Mar 2011 11:57:03 -0700
Rodrigo,
I'm not sure, even after reading your entire message, what you're trying to accomplish. But, from what you mention, you seem to want to provide your boss with a way to bypass some login screen or automatically enter a user name, is that right?
I wrote an application which kind of does what you're trying to do. If you have to show the login screen or the screen when the user name is entered, it will not work. In my application, I have my own view for the user to enter his user name. I even provide an option so that his user name is saved so that the next time, I can retrieve it. Then, the trick is to keep the UIWebView hidden. You just don't show it and using the "stringByEvaluatingJavascriptFromString:", you can provide the user name and even trigger the button that will allow the login. From that point, when the UIWebView starts loading the next page after the login, you can show it.
I can provide you more details privately if you're interested, just email me.
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/
Logiciels Nemesys Software email@hidden
On Mar 23, 2011, at 11:25, Rodrigo Zanatta Silva wrote:
> 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?
_______________________________________________
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