美文网首页
iOS开发手势返回-全屏

iOS开发手势返回-全屏

作者: 哈哈哈努力加油吧 | 来源:发表于2018-11-05 14:41 被阅读0次

    在你的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>代理)

    相关文章

      网友评论

          本文标题:iOS开发手势返回-全屏

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