Remove UIEditMenuInteraction from PKCanvasView

233 views Asked by At

I have been working with PencilKit for quite some time now and never had any problems with it. However, since updating to iOS17 my app shows a menu when the PKCanvasView is tapped.

enter image description here

As I implement my own menu I want to remove this, but unfortunately I do not have any idea how to do this.

1

There are 1 answers

1
Kamil On BEST ANSWER

This is the thing that worked for me

extension PKCanvasView {
    func disableMenuInteractions() {
        let views = [self] + self.allSubviewsRecursive()
        for view in views {
            for interaction in view.interactions where interaction is UIEditMenuInteraction {
                view.removeInteraction(interaction)
            }
        }
    }
}