自定义导航控制器内, 启用屏幕边缘返回手势
/*
统一设置返回按钮后,启用屏幕边缘滑动返回
1,遵守协议 UIGestureRecognizerDelegate
2,设置代理 self.interactivePopGestureRecognizer.delegate = self;
3,实现代理方法
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return self.childViewControllers.count > 1;
}
*/
自定义导航控制器内, 启用全屏返回手势
/*
统一设置返回按钮后,启用全屏滑动返回
1,遵守协议 UIGestureRecognizerDelegate
2,创建pan手势
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self.interactivePopGestureRecognizer.delegate action:@selector(handleNavigationTransition:)];
//添加手势
[self.view addGestureRecognizer:pan];
3,设置代理
pan.delegate = self;
4,禁用屏幕边缘返回手势
self.interactivePopGestureRecognizer.enabled = NO;
5,实现代理方法
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
//防止根控制器启用滑动返回
return self.childViewControllers.count > 1;
}
*/