Instance Method

targetForAction:withSender:

Returns the target object that responds to an action.

Declaration

- (id)targetForAction:(SEL)action withSender:(id)sender;

Parameters

action

A selector that identifies a method associated with a command.

sender

The object calling this method. For the editing menu commands, this is the shared UIApplication object. Depending on the context, you can query the sender for information to help you determine the target of the command.

Return Value

The object whose action method is invoked to execute the command.

Discussion

This method is called whenever an action needs to be invoked by the object. The default implementation calls the canPerformAction:withSender: method to determine whether it can invoke the action. If the object can invoke the action, it returns itself, otherwise it passes the request up the responder chain. Your app should override this method if it wants to override how a target is selected.

See Also

Building and Validating Commands

- validateCommand:

Asks the receiving responder to validate the command.

Beta
- canPerformAction:withSender:

Requests the receiving responder to enable or disable the specified command in the user interface.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software