监听屏幕边缘侧滑返回手势
2016-11-03 本文已影响213人
NateLam
-
第一步, 签代理
@interface NAFirstBookStoreViewController ()<UIGestureRecognizerDelegate>
-
第二步, 指定代理人
self.navigationController.interactivePopGestureRecognizer.delegate = self;
-
重写协议方法
- (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; } }