How to tell when a UIMenu gets DISMISSED

Viewed 497

I have a UIButton with a UIMenu attached, I need to know when the UIMenu is dismissed (by tapping outside the UIMenu) so I can remove the button that the UIMenu is attached to.

I have seen there are notifications for UIMenuController, but that is different.

edit: Here's some additional info because this question was related to a different question.

I don't care when the UIMenu is called, I only care when it is dismissed

1 Answers

You have to create custom button (for call menu) and override its method contextMenuInteraction(_:willEndFor:animator:). Add your action inside this method for removing the button that the UIMenu is attached to.

Related