Instance Method

pressesBegan:withEvent:

Tells this object when a physical button is first pressed.

Declaration

- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event;

Parameters

presses

A set of UIPress instances that represent the new presses that occurred. The phase of each press is set to UIPressPhaseBegan.

event

The event to which the presses belong.

Discussion

UIKit calls this method when a new button is pressed by the user. Use this method to determine which button was pressed and to take any needed actions.

The default implementation of this method forwards the message up the responder chain. When creating your own subclasses, call super to forward any events that you do not handle yourself.

See Also

Responding to Press Events

- pressesChanged:withEvent:

Tells this object when a value associated with a press has changed.

- pressesEnded:withEvent:

Tells the object when a button is released.

- pressesCancelled:withEvent:

Tells this object when a system event (such as a low-memory warning) cancels a press event.

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