美文网首页
三行代码禁用侧滑返回

三行代码禁用侧滑返回

作者: 王煜仁 | 来源:发表于2021-03-18 11:29 被阅读0次

    在viewWillAppear中添加以下代码即可

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

    相关文章

      网友评论

          本文标题:三行代码禁用侧滑返回

          本文链接:https://www.haomeiwen.com/subject/ynuucltx.html