Touches, Presses, and Gestures

Encapsulate your app's event-handling logic in gesture recognizers so that you can reuse that code throughout your app.


If you build your apps using standard UIKit views and controls, UIKit automatically handles touch events (including Multitouch events) for you. However, if you use custom views to display your content, you must handle all touch events that occur in your views. There are two ways to handle touch events yourself.


First Steps

Using Responders and the Responder Chain to Handle Events

Learn how to handle events that propagate through your app.

class UIResponder

An abstract interface for responding to and handling events.

class UIEvent

An object that describes a single user interaction with your app.


Handling Touches in Your View

Use touch events directly on a view subclass if touch handling is intricately linked to the view's content.

Handling Input from Apple Pencil

Learn how to detect and respond to touches from Apple Pencil.

Tracking the Force of 3D Touch Events

Manipulate your content based on the force of touches.

Leveraging Touch Input for Drawing Apps

Capture touches as a series of strokes and render them efficiently on a drawing canvas.

class UITouch

An object representing the location, size, movement, and force of a touch occurring on the screen.

Button Presses

class UIPress

An object that represents the presence or movement of a button press on the screen for a particular event.

class UIPressesEvent

An event that describes the state of a set of physical buttons that are available to the device, such as those on an associated remote or game controller.

Standard Gestures

Handling UIKit Gestures

Use gesture recognizers to simplify touch handling and create a consistent user experience.

Coordinating Multiple Gesture Recognizers

Discover how to use multiple gesture recognizers on the same view.

class UIHoverGestureRecognizer

A discrete gesture recognizer that interprets pointer movement over a view.

class UILongPressGestureRecognizer

A discrete gesture recognizer that interprets long-press gestures.

class UIPanGestureRecognizer

A discrete gesture recognizer that interprets panning gestures.

class UIPinchGestureRecognizer

A discrete gesture recognizer that interprets pinching gestures involving two touches.

class UIRotationGestureRecognizer

A discrete gesture recognizer that interprets rotation gestures involving two touches.

class UIScreenEdgePanGestureRecognizer

A discrete gesture recognizer that interprets panning gestures that start near an edge of the screen.

class UISwipeGestureRecognizer

A discrete gesture recognizer that interprets swiping gestures in one or more directions.

class UITapGestureRecognizer

A discrete gesture recognizer that interprets single or multiple taps.

Custom Gestures

Implementing a Custom Gesture Recognizer

Discover when and how to build your own gesture recognizers

class UIGestureRecognizer

The base class for concrete gesture recognizers.

protocol UIGestureRecognizerDelegate

A set of methods implemented by the delegate of a gesture recognizer to fine-tune an app’s gesture-recognition behavior.

3D Touch Interactions

class UIPreviewInteraction

A class that registers a view to provide a custom user experience in response to 3D Touch interactions.

protocol UIPreviewInteractionDelegate

A set of methods for communicating the progress of a preview interaction.

protocol UIPreviewActionItem

A set of methods that defines the styles you can apply to peek quick actions and peek quick action groups, and defines a read-only accessor for the user-visible title of a peek quick action.

See Also

User Interactions

Drag and Drop

Bring drag and drop to your app by using interaction APIs with your views.

Pointer Interactions

Support pointer interactions in your custom controls and views.

Pencil Interactions

Handle double-tap user interactions on Apple Pencil.

Focus-based Navigation

Navigate the interface of your UIKit app using a remote or a game controller.

Menus and Shortcuts

Simplify interactions with your app using menu systems, contextual menus, Home screen quick actions, and keyboard shortcuts.


Make your apps accessible to everyone, including people with disabilities.