PDA

View Full Version : IBAction calling a method




newConvert
Apr 10, 2009, 03:18 PM
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:@"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!



dejo
Apr 10, 2009, 03:29 PM
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];