A view that captures Apple Pencil input and displays the rendered results in an iOS app.


@interface PKCanvasView : UIScrollView


A PKCanvasView object captures content drawn using Apple Pencil or the user’s finger and displays it in your app. Add a canvas view to your interface when you want to capture or display user-drawn content. The canvas view handles all of the touch events and data coming from Apple Pencil, and renders that information using the tool you specify. The canvas stores the captured input in a PKDrawing object.

PKCanvasView is a scroll view, so you can make the drawable area bigger than the canvas view’s frame rectangle. To do that, set the inherited contentSize property to the size you want. The canvas view automatically scales its underlying content to match the size you specify. Users scroll around the canvas using a two-finger pan gesture. (If the allowsFingerDrawing property is false, users scroll with only one finger.)

A canvas view conforms to the PKToolPickerObserver protocol, so you can add it as an observer of the window’s tool picker. The tool picker displays a floating palette of tools for the user to choose from. As the user interacts with items in the palette, the canvas automatically updates its drawing environment accordingly.


Responding to Drawing-Related Changes


The object you use to respond to changes in the drawn content or in the selected tool.


Methods you use to track editing-related changes in a canvas view.

Configuring the Drawing Environment


The currently selected tool for drawing.


A Boolean value that indicates whether a ruler view is currently visible on the canvas.


A Boolean value that indicates whether the canvas accepts input from the user’s finger in addition to Apple Pencil.

Getting the Drawing Gesture Recognizer


The gesture recognizer that the canvas uses to track touch events.

Getting the Captured Data


The data object that the canvas uses to store drawn content.


Inherits From

See Also



An opaque data object that contains the drawing information captured by a canvas view.