禁止导航条右滑返回上一页

1,遵循协议
UIGestureRecognizerDelegate,UINavigationBarDelegate
2,

 id target = self.navigationController.interactivePopGestureRecognizer.delegate;
    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(handleNavigationTransition:)];
    pan.delegate = self;
    [self.videoView addGestureRecognizer:pan];
    self.navigationController.interactivePopGestureRecognizer.enabled = NO;

3,

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
    if (self.childViewControllers.count == 1) {
        return NO;
    }
    return YES;
}

猜你喜欢

转载自blog.csdn.net/ZHUTAN_123/article/details/77862884