自定义导航控制器
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
//获取系统手势对象
let target = self.interactivePopGestureRecognizer?.delegate
//创建新手势
let panGesture = UIPanGestureRecognizer(target: target, action:Selector("handleNavigationTransition:"))
//设置代理
panGesture.delegate = self
//添加手势
view.addGestureRecognizer(panGesture)
// print(self.interactivePopGestureRecognizer)
//禁用系统手势
self.interactivePopGestureRecognizer?.enabled = false
}
//代理方法控制根控制器不动
extension HnavigationViewController:UIGestureRecognizerDelegate{
func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool {
if self.childViewControllers.count == 1 {
return false
}
return true
}
}