IBAction calling a method

Discussion in 'iOS Programming' started by newConvert, Apr 10, 2009.

  1. newConvert macrumors regular

    Aug 25, 2006
    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. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    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