Class

PKDrawing

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

Declaration

@interface PKDrawing : NSObject

Overview

A PKDrawing object stores the user-drawn content from a PKCanvasView object. You use drawing objects to store the data associated with your user’s drawings. You can save this data with the rest of your app’s content, and you can use that saved data to create a new drawing object later. You can also generate an image based on the drawn content.

Topics

Creating a Drawing Object

- initWithData:error:

Creates a drawing object and populates it with previously drawn content.

- init

Creates a drawing object with no initial content.

Getting the Canvas Bounds

bounds

The smallest rectangle that represents the content's bounds, taking into account line widths of that content.

Generating an Image

- imageFromRect:scale:

Returns an image object containing the specified portion of the drawing.

Getting the Drawing Data

- dataRepresentation

Returns an opaque representation of the rendered content.

PKAppleDrawingTypeIdentifier

The uniform type identifier for data associated with a drawing object.

Modifying the Drawing

- drawingByApplyingTransform:

Returns a new drawing object by applying the specified transform to a copy of the current object’s contents.

- drawingByAppendingDrawing:

Returns a copy of the current drawing object and appends the specified content to it.

Relationships

Inherits From

See Also

Canvas

PKCanvasView

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