Determine when a UIMenuController is dismissed?

后端 未结 4 1143
执笔经年
执笔经年 2021-02-01 06:55

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-high

4条回答
  •  面向向阳花
    2021-02-01 07:34

    Swift 3 & 4

    NotificationCenter.default.addObserver(
       self,
       selector: #selector(self.didHideEditMenu),
       name: NSNotification.Name.UIMenuControllerDidHideMenu,
       object: nil)
    
    NotificationCenter.default.addObserver(
       self,
       selector: #selector(self.willHideEditMenu),
       name: NSNotification.Name.UIMenuControllerWillHideMenu,
       object: nil)
    

提交回复
热议问题