iOS开发手势返回-全屏

2018-11-05  本文已影响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>代理)

上一篇下一篇

猜你喜欢

热点阅读