 
 open class UISideMenuNavigationController: UINavigationController {
     
-    fileprivate weak var temporarySideMenuDelegate: UISideMenuNavigationControllerDelegate?
+    fileprivate weak var foundDelegate: UISideMenuNavigationControllerDelegate?
+    fileprivate weak var activeDelegate: UISideMenuNavigationControllerDelegate? {
+        get {
+            guard !view.isHidden else {
+                return nil
+            }
+            
+            return sideMenuDelegate ?? foundDelegate ?? findDelegate(forViewController: presentingViewController)
+        }
+    }
     fileprivate func findDelegate(forViewController: UIViewController?) -> UISideMenuNavigationControllerDelegate? {
         if let navigationController = forViewController as? UINavigationController {
             return findDelegate(forViewController: navigationController.topViewController)

            return findDelegate(forViewController: splitViewController.viewControllers.last)
        }
        
        temporarySideMenuDelegate = forViewController as? UISideMenuNavigationControllerDelegate
        return temporarySideMenuDelegate
    }
    fileprivate var usingInterfaceBuilder = false
    internal var locked = false

            return
        }
        
        let activeDelegate = self.activeDelegate
        foundDelegate = nil
        
        // To avoid overlapping dismiss & pop/push calls, create a transaction block where the menu
        // is dismissed after showing the appropriate screen
        CATransaction.begin()
        if sideMenuManager.menuDismissOnPush {
            CATransaction.setCompletionBlock( { () -> Void in
                activeDelegate?.sideMenuDidDisappear(menu: self, animated: animated)
                if !animated {
                    self.transition.hideMenuStart().hideMenuComplete()
                }
