The UIMenuController
will post a notification just after it hides called UIMenuControllerDidHideMenuNotification
, you can subscribe to this notification to call a method that in turn calls deselectRowAtIndexPath
on your table view. for example:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(yourMethodHere) name:UIMenuControllerDidHideMenuNotification object:nil];
And in Swift 5:
NotificationCenter.default.addObserver(self,
selector: #selector(self.receiveNotification(_:)),
name: UIMenuController.didShowMenuNotification,
object: nil)
And to handle the notification:
@objc func receiveNotification(_ notification: Notification) {
// do something here
}