Possible Duplicate:
Objective C: what is a “(id) sender”?
What is the (id)sender for in:
-(IBAction)action:(id)sender;
Thanks for your help!
Possible Duplicate:
Objective C: what is a “(id) sender”?
What is the (id)sender for in:
-(IBAction)action:(id)sender;
Thanks for your help!
It is whatever object has called the action method; e.g., a button.
You can use the id to check which of a set of buttons called the action, for instance.
It identifies (and references) the control object that sent the action message.
From the target-action design pattern:
The sender parameter is the control object sending the action message. When responding to an action message, you may query sender to get more information about the context of the event triggering the action message.