Open iceman201 opened 8 years ago
internal func topMostController () -> ENSideMenuProtocol? { var topController : UIViewController? = UIApplication.sharedApplication().keyWindow?.rootViewController if (topController is UITabBarController) { topController = (topController as! UITabBarController).selectedViewController } var lastMenuProtocol : ENSideMenuProtocol? while (topController?.presentedViewController != nil) { if(topController?.presentedViewController is ENSideMenuProtocol) { lastMenuProtocol = topController?.presentedViewController as? ENSideMenuProtocol } topController = topController?.presentedViewController } if (lastMenuProtocol != nil) { return lastMenuProtocol } else { return topController as? ENSideMenuProtocol } }