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

2016-11-03  本文已影响213人  NateLam
  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;
     }
     }
上一篇下一篇

猜你喜欢

热点阅读