在你的UINavigationController基类中添加如下代码
-(void)gestureConfig{
id target = self.interactivePopGestureRecognizer.delegate;
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:target action:NSSelectorFromString(@"handleNavigationTransition:")];
pan.delegate=self;
[self.view addGestureRecognizer:pan];
self.interactivePopGestureRecognizer.enabled = NO;
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
if (self.childViewControllers.count == 1) {
returnNO;
}
return YES;
}
(注:别忘了添加<UIGestureRecognizerDelegate>代理)
网友评论