IBAction calling a method

Discussion in 'iPhone/iPad Programming' started by newConvert, Apr 10, 2009.

  1. macrumors regular

    Joined:
    Aug 25, 2006
    #1
    Hey all,

    I have created a function that will add people in a database, and I would like to use this function in my IBACTION method that is connected to a button.

    Essentially all I have is:

    - (IBAction)someFunction{

    <other code>
    addPerson:mad:"Person Name";
    <other codee>
    }

    now for some reason it does not add the person into the DB, however when I copy the code out of the "Add Person" method and have it directly in the IBAction, it works... any ideas why?

    The DB gets created/loaded when the app fires up, in the same class as the actions/methods.

    Thanks so much!
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    addPerson is the name of the message but you need to tell it what object/class to send it to. Along the lines of [receiver message];
     

Share This Page