三行代码禁用侧滑返回

在viewWillAppear中添加以下代码即可

//禁用右滑返回
    id traget = self.navigationController.interactivePopGestureRecognizer.delegate;
    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:traget action:nil];
    [self.view addGestureRecognizer:pan];

你可能感兴趣的:(三行代码禁用侧滑返回)