我如何获得SideMenu提交和解除的事件

问题描述:

我从https://github.com/jonkykong/SideMenu实施SideMenu框架。我如何获得SideMenu提交和解除的事件

我想在自己的类中实现SideMenu类的方法,以便在侧菜单显示或取消时更改我的UIImage。

这从侧面菜单类中的方法

// MARK: UIViewControllerTransitioningDelegate protocol methods 

// return the animator when presenting a viewcontroller 
// rememeber that an animator (or animation controller) is any object that aheres to the UIViewControllerAnimatedTransitioning protocol 
open func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { 
    self.presenting = true 
    SideMenuTransition.presentDirection = presented == SideMenuManager.menuLeftNavigationController ? .left : .right 
    return self 
} 

// return the animator used when dismissing from a viewcontroller 
open func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { 
    presenting = false 
    return self 
} 

你需要继承UISideMenuNavigationController得到ViewDidAppear和ViewDidDisappear。检查答案How do I insert code in ViewDidAppear and ViewDidDisappear From other class