Contents

actions(forTarget:forControlEvent:)

Returns the actions performed on a target object when the specified event occurs.

Declaration

func actions(forTarget target: Any?, forControlEvent controlEvent: UIControl.Event) -> [String]?

Parameters

  • target:

    The target object—that is, an object that has an action method associated with this control. You must pass an explicit object for this method to return a meaningful result. Specifying nil always returns nil.

  • controlEvent:

    A single control event constant representing the event for which you want the list of action methods. For a list of possible constants, see Event

Return Value

An array NSString objects containing the selector names of the corresponding action methods, or nil if there are no action methods associated with the specified target object and control event.

Discussion

Use this method to determine what action methods are called on the specified object in response to a particular control event. You can use the NSSelectorFromString(_:) function to convert the returned strings to valid selectors, as needed.

See Also

Related Documentation

Managing the control’s targets and actions