PKToolPicker
A tool palette that displays a selection of drawing tools and colors for tools that a person can choose from.
Declaration
class PKToolPickerMentioned in
Overview
A PKToolPicker manages a draggable palette that displays drawing tools, colors, and additional options. You add a tool picker to your interface and configure it to display its palette at appropriate times. While the palette is onscreen, a person may reposition it anywhere within the current window. When a person interacts with the palette, the tool picker notifies registered observers of the changes so that they can respond.
When configuring your interface, call the setVisible(_:forFirstResponder:) method to associate the tool picker with one or more views in your interface. Each window manages its own tool picker, and the window’s first responder determines the visibility of that tool picker. When one of the registered objects becomes first responder, the tool picker automatically adds its palette view to the current window. When there isn’t a registered object as first responder, the tool picker hides its palette view.
PKCanvasView implements the observer protocol for detecting tool picker changes. Adding your canvas view as an observer to a tool picker automatically updates the current drawing tools. For more information about implementing custom observer objects, see PKToolPickerObserver.
Topics
Creating a tool picker
init()init(toolItems:)PKToolPickerInkingItemPKToolPickerEraserItemPKToolPickerLassoItemPKToolPickerRulerItemPKToolPickerScribbleItemPKToolPickerCustomItemPKToolPickerItem
Accessing the picker’s tools
Detecting changes to the picker
Coordinating the visibility of the picker
Managing selected tools
Customizing picker behavior
isRulerActivecolorUserInterfaceStyleoverrideUserInterfaceStyleshowsDrawingPolicyControlsstateAutosaveName