From the course: iPadOS 13 Development Essential Training
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Using a PKToolPicker - iOS Tutorial
From the course: iPadOS 13 Development Essential Training
Using a PKToolPicker
- [Narrator] To add the set of default drawing tools you simply have to associate them with the CanvasView. The way that they work is, as long as the CanvasView is the First Responder you'll see the tools on the screen. So let's go inside of here and write the code. I'm first going to press command + option + return to hide the layout view. So in here, I'm going to create a picker. So if let picker equal, PKToolPicker.shared for then we need to pass in a window. We can simply get that from UI application.shared.windows index zero, curly braces after that. Then what we're going to do is set it to be visible. So picker.setvisible and this is true for a particular First Responder, our First Responder's going to be a canvasView. Go to the next line then recall, picker.addObserver and what this does, it says it adds the specified object to the list of objects to notify when the picker configuration changes. So if we ever…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.