Determine when a UIMenuController is dismissed?

Viewed 6949

Is there a way to determine when a UIMenuController has been dismissed? I have a (non-editable) text area I'm highlighting when the menu is brought up, and I'd like to un-highlight it when they either select an item (easy) or cancel (not possible?)

4 Answers

Swift 5

NotificationCenter.default.addObserver(
        self,
        selector: #selector(willHideMenu),
        name: UIMenuController.willHideMenuNotification,
        object: nil)
Related