Browser problem - autofill URL and Keyboard is hidden

Discussion in 'iOS Programming' started by mcnuggets, Jan 31, 2009.

  1. mcnuggets macrumors newbie

    Joined:
    Jan 2, 2009
    #1
    So I'm following this browser sample and found two problems that I can't figure out on resolving.

    Problems:

    1) I notice on the address bar, I always have to type in: "http://www. {URL NAME} . com". I want it so that I don't have to type in "http://" everytime I want to go to a URL.

    2) I go to google.com on the webview. Once I'm on google's website, I click on the Google Search text bar to type but my keyboard that pops up doesn't display the keyboard layout.

    Please help me on this because this is driving me bananas.

    Source code that I'm playing with is located on:
    http://icodeblog.com/wp-content/uploads/2008/12/icodebrowser.zip
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Before doing anything with the addressBar.text, check to see if it starts with 'http://'. If it does, continue. If it doesn't, add it.

    I'll look at #2 later.
     
  3. mcnuggets thread starter macrumors newbie

    Joined:
    Jan 2, 2009
    #3
    Thanks for replying. But what if you just want a default of "http://" everytime in the addressBar? So basically as a default... http:// is automatically insert everytime. I don't need error correction.

    I'm guessing it's in this syntax on the "gotoAddress" action. Is the syntax this:

    NSURL *url = [NSURL URLWithString:[@"http://www.%@", addressBar text]];

    I tried that string and it wont work. Any help?
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Won't work? In which way? Do you get an error?

    Also, you need to reference it as [addressBar text] and I don't think you can build the string as shown within the URLWithString. Try this instead:
    Code:
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.%@", [addressBar text]]];
     
  5. mcnuggets thread starter macrumors newbie

    Joined:
    Jan 2, 2009
    #5

    You're just too awesome. It works. :D

    By the way, were you able to figure out a solution to my 2nd problem?
     

Share This Page