I have added notification observer for UIMenuControllerWillHideMenu
but it does not call selector added/associated with notification center.
UIMenuControllerWillHideMenu
is notification center identifier for UIMenuController
and should be called when UIMenuController
will hide. But somehow it's not working.
Here is code I've tried (Swift 3.x):
private func addMenuObserverNotification(){
NotificationCenter.default.addObserver(self, selector: #selector(self.menuControllerWillHideMenu), name: NSNotification.Name(rawValue: "UIMenuControllerWillHideMenu"), object: nil)
}
// This function should be called on 'UIMenuControllerWillHideMenu'
func menuControllerWillHideMenu() -> Void {
removeMenuObserverNotification()
}
private func removeMenuObserverNotification(){
NotificationCenter.default.removeObserver(self)
}
Unable to identify, what's wrong.