Resolved Button open url in safari

Discussion in 'iOS Programming' started by eplefrik, Mar 25, 2012.

  1. eplefrik, Mar 25, 2012
    Last edited: Mar 25, 2012

    eplefrik macrumors newbie

    Joined:
    Mar 25, 2012
    #1
    Hi!

    This code open a url in safari on click:

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mad:"http://www.apple.com"]];

    But I don't know where the code should be. I tried to put in in ViewController.m below the viewDidUnload. But I can't get the button to work.

    I'm new with XCode, so hope someone can help me.

    Sorry for my english.
     
  2. Nemox macrumors newbie

    Joined:
    Oct 3, 2011
    #2
    What you posted is just a piece of code, you need to put it inside a method.

    You would benefit a lot from reading about Objective-c
     
  3. eplefrik thread starter macrumors newbie

    Joined:
    Mar 25, 2012
    #3
    Ok, thanks! But can you give me the whole code, and where I should insert it?
     
  4. Nemox macrumors newbie

    Joined:
    Oct 3, 2011
    #4
    No I will not give you the whole code, what good will that do you?

    You need to start in baby steps and then improve. You wont improve if you don't understand how method, Objects etc works.

    So as i stated, start by learning something about the basics of the language you want to code in.

    I dont say this to be a douche, but to be honest, if you skip over the basics, you will never understand how to code stuff.
     
  5. eplefrik thread starter macrumors newbie

    Joined:
    Mar 25, 2012
    #5
    Okey, but do you know about some good webpages where I can learn about Objective-C ?
     
  6. Nemox macrumors newbie

    Joined:
    Oct 3, 2011
    #6
  7. eplefrik thread starter macrumors newbie

    Joined:
    Mar 25, 2012
    #7

Share This Page