|
|
|
@@ -170,13 +170,19 @@ open class UISideMenuNavigationController: UINavigationController {
|
|
|
|
|
override open func viewWillDisappear(_ animated: Bool) {
|
|
|
|
|
super.viewWillDisappear(animated)
|
|
|
|
|
|
|
|
|
|
defer {
|
|
|
|
|
activeDelegate?.sideMenuWillDisappear?(menu: self, animated: animated)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guard !isBeingDismissed else { return }
|
|
|
|
|
|
|
|
|
|
// When presenting a view controller from the menu, the menu view gets moved into another transition view above our transition container
|
|
|
|
|
// which can break the visual layout we had before. So, we move the menu view back to its original transition view to preserve it.
|
|
|
|
|
if let presentingView = presentingViewController?.view, let containerView = presentingView.superview {
|
|
|
|
|
containerView.addSubview(view)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !isBeingDismissed && dismissOnPresent {
|
|
|
|
|
if dismissOnPresent {
|
|
|
|
|
// We're presenting a view controller from the menu, so we need to hide the menu so it isn't showing when the presented view is dismissed.
|
|
|
|
|
transitionController?.transition(presenting: false, animated: animated, alongsideTransition: { [weak self] in
|
|
|
|
|
guard let self = self else { return }
|
|
|
|
@@ -187,8 +193,6 @@ open class UISideMenuNavigationController: UINavigationController {
|
|
|
|
|
self.view.isHidden = true
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
activeDelegate?.sideMenuWillDisappear?(menu: self, animated: animated)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override open func viewDidDisappear(_ animated: Bool) {
|
|
|
|
@@ -214,7 +218,6 @@ open class UISideMenuNavigationController: UINavigationController {
|
|
|
|
|
|
|
|
|
|
if isBeingDismissed {
|
|
|
|
|
transitionController = nil
|
|
|
|
|
interactive = false
|
|
|
|
|
} else if dismissOnPresent {
|
|
|
|
|
view.isHidden = true
|
|
|
|
|
}
|
|
|
|
@@ -419,10 +422,12 @@ extension UISideMenuNavigationController: UIViewControllerTransitioningDelegate
|
|
|
|
|
extension UISideMenuNavigationController: SideMenuTransitionControllerDelegate {
|
|
|
|
|
|
|
|
|
|
internal func sideMenuTransitionController(_ transitionController: SideMenuTransitionController, didDismiss viewController: UIViewController) {
|
|
|
|
|
interactive = false
|
|
|
|
|
sideMenuManager.sideMenuTransitionDidDismiss(menu: self)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal func sideMenuTransitionController(_ transitionController: SideMenuTransitionController, didPresent viewController: UIViewController) {
|
|
|
|
|
interactive = false
|
|
|
|
|
removeSwipeGesture()
|
|
|
|
|
swipeToDismissGesture = addSwipeToDismissGesture(to: view.superview)
|
|
|
|
|
tapToDismissGesture = addTapToDismissGesture(to: view.superview)
|
|
|
|
|