/// 启用手势返回
func enableGesturePop(gestureDelegate: UIGestureRecognizerDelegate, interactiveEnable: Bool, navigationViewEnable: Bool) {
let target = self.interactivePopGestureRecognizer?.delegate
let panGesture = UIPanGestureRecognizer(target: target, action: "handleNavigationTransition:")
panGesture.delegate = gestureDelegate
if navigationViewEnable {
self.view.addGestureRecognizer(panGesture)
} else {
let control = self.viewControllers.last
control?.view.addGestureRecognizer(panGesture)
}
self.interactivePopGestureRecognizer?.enabled = interactiveEnable
}
/// 启用手势返回
func enableGesturePop(gestureDelegate: UIGestureRecognizerDelegate) {
enableGesturePop(gestureDelegate, interactiveEnable: true, navigationViewEnable: false)
}
UIGestureRecognizerDelegate 委托来自控制器,用于控制该类是否启用手势返回