Web View and URL?

Discussion in 'Mac Programming' started by DeviledMoon, Oct 19, 2010.

  1. macrumors newbie

    Joined:
    Oct 13, 2010
    #1
    Hey Guys,

    Im working on a web app for my mac's that i might release out to everyone when i finish up what im doing with it.

    but heres my issue, i cant seem to find a way to load a url into the Web View Component...

    Could anyone give me an example of how i can do this?

    Thanks,
    DeviledMoon
     
  2. macrumors member

    Joined:
    Jul 18, 2009
    #2
    Connect the UIWebView from your IB to your controller by making a property.

    Then use this:

    Code:
    NSURL *url = [[NSURL alloc] initWithString:@"http://myurl"];
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
    [[webBrowser mainFrame] loadRequest:request];
    
     
  3. thread starter macrumors newbie

    Joined:
    Oct 13, 2010
    #3

    Thanks Man, Worked Wonders :D
     
  4. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    and don't forget to release those objects, or you'll have memory leaks.
     
  5. thread starter macrumors newbie

    Joined:
    Oct 13, 2010
    #5
    of course... me and my team just started on the whole apple developer system, we got a lot of apps coming to the mac and iphone/ipod/ipad

    i have a basic knowledge of how to develop for the platform, i know enough to get by and kill all the leaks and what not, just some of the stuff in Xcode/cocoa throws me off lol


    Thanks for reminding though!

    Oh.
    Unrelated question, Key commands... lets say i want to use the menu command (OpenApple+Fn+1), how would i detect that? ive look it up on the developer resources from apple, but unfortunately they arent that helpful.
     
  6. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    I'd suggest a new thread for this since it's quite off-topic. :)
     

Share This Page