What is (id) sender for in action (IBAction): (id) sender;

Possible duplicate:
Goal C: what is the sender (?)?

What is the (id) sender for:

-(IBAction)action:(id)sender; 

Thank you for your help!

+4
source share
3 answers

This is any object that called an action method; e.g. buttons.

You can use an identifier to check which of a set of buttons is called an action, for example.

+4
source

It identifies (and links) the management entity that sent the action message.

+2
source

From the target-action design template:

The sender parameter is the management entity that sends the action message. When replying to an action message, you can ask the sender to get more information about the context of the event that triggered the action message.

+1
source

All Articles