2

If you have a UIWebView with a textfield and a button that takes the value from that textfield and then performs some action.

When you touch the textfield, the keyboard is displayed with a Go Button. I'm trying to figure out what exactly happens under the hood when that Go Button is pressed?

How I would simulate that action programmatically?

AaronG
  • 532
  • 1
  • 7
  • 18

1 Answers1

0

The following will be used, when user press on GO button of Keyboard ...

     NSString *urlAddress = mytextFieldText.text;
    //Create a URL object.
    NSURL *url = [NSURL URLWithString:urlAddress];
    NSURLRequest *aRequest = [NSURLRequest requestWithURL:aURL];
    //load the index.html file into the web view.
    [aWebView loadRequest:aRequest];

Thanks

Check the below SO post for listening to keyboard GO button in UITextField.

Dismiss iphone keyboard

Community
  • 1
  • 1
Jhaliya - Praveen Sharma
  • 31,697
  • 9
  • 72
  • 76
  • If you have a UIWebView loaded with google and you enter a search term and press GO, how does the GO button know that it should press the search button? What if there are multiple buttons on the webpage? How does GO know what to do? – AaronG Apr 08 '11 at 01:31
  • It should behave the way any normal web form would when hitting enter. In most browsers when you hit return if the text box is in a form with a submit type of input field, the form will get submitted. – criscokid Apr 08 '11 at 05:40