I have two buttons which call the same function. That functions signature is
- (IBAction)eraseTextField {...}
I would like to figure out what button called the function. So I would like for the functions signature to be something like
- (IBAction)eraseTextField: (id)sender {...}.
Is there a way for the system to know to send the id of the calling object to a function that it calls? Thanks for the help.
if you use
- (IBAction)eraseTextField: (id)senderit will work with interface builder the way you think and sender will be the id of the object that sent the method in IB.You can choose to write your methods with either
- (IBAction)eraseTextField and - (IBAction)eraseTextField:(id)senderboth work fine and the sender will be the id of the sender object.