'How to tell when a UIMenu gets DISMISSED
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
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | zslavman |