Clear undo buffer for PKCanvasView

734 views Asked by At

I'm experimenting with Apple's PencilKit. Showing the PKToolPicker works well and I can draw into my canvas. However, I wondered whether and if so, how it is possible to clear the undo buffer.

Background: I'm allowing the user to flip through his drawings, but the undo buttons are still available on the iPad even if I assign a new drawing to the PKCanvasView. I would like to clear the undo buffer before I show one of the previous drawings.

I've tried to clear the parent view controller's undo buffer and the PKCanvasView's undo buffer by calling

self.undoManager?.removeAllActions()
self.canvasView.undoManager?.removeAllActions()

to no avail.

Optionally, it would also be ok for me to just hide the undo/redo buttons from the PKToolPicker on the iPad. Is this possible?

0

There are 0 answers