美文网首页
监听屏幕边缘侧滑返回手势

监听屏幕边缘侧滑返回手势

作者: NateLam | 来源:发表于2016-11-03 12:16 被阅读213次
    1. 第一步, 签代理

       @interface NAFirstBookStoreViewController ()<UIGestureRecognizerDelegate>
      
    2. 第二步, 指定代理人

      self.navigationController.interactivePopGestureRecognizer.delegate = self;
      
    3. 重写协议方法

       - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
      
       UIViewController *target = nil;
       for (UIViewController * controller in self.navigationController.viewControllers) { //遍历
       if ([controller isKindOfClass:[NAFirstSignPointsMallViewController class]]) { //这里判断是否为你想要跳转的页面
           target = controller;
       }
       }
       if (target) {
       [self.navigationController popToViewController:target animated:YES]; //跳转
       return NO;
        }
       else{
       return NO;
       }
       }

    相关文章

      网友评论

          本文标题:监听屏幕边缘侧滑返回手势

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