Web View and URL?

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

  1. macrumors newbie

    Oct 13, 2010
    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?

  2. macrumors member

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

    Then use this:

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

    Oct 13, 2010

    Thanks Man, Worked Wonders :D
  4. Moderator emeritus


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

    Oct 13, 2010
    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!

    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


    Staff Member

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

Share This Page