From c2c1d0ae7187ee4c0fd0571f0f1fe8ca3eb3e98b Mon Sep 17 00:00:00 2001 From: "weiping.lii" Date: Tue, 13 Mar 2018 15:34:16 +0800 Subject: [PATCH] [MDF] support simultaneous gesture --- ...NavigationController+FDFullscreenPopGesture.h | 2 ++ ...NavigationController+FDFullscreenPopGesture.m | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.h b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.h index 1be8de7..cca8578 100644 --- a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.h +++ b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.h @@ -59,4 +59,6 @@ /// gesture. 0 by default, which means it will ignore this limit. @property (nonatomic, assign) CGFloat fd_interactivePopMaxAllowedInitialDistanceToLeftEdge; +@property (assign, nonatomic) BOOL fd_shouldSimultaneouslyRecognizeFullScreenPopGesture; + @end diff --git a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m index 71871dc..3ba998b 100644 --- a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m +++ b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m @@ -67,6 +67,14 @@ - (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer return YES; } +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { + UIViewController *controller = self.navigationController.viewControllers.lastObject; + if (controller && controller.fd_shouldSimultaneouslyRecognizeFullScreenPopGesture) { + return controller.fd_shouldSimultaneouslyRecognizeFullScreenPopGesture; + } + return NO; +} + @end typedef void (^_FDViewControllerWillAppearInjectBlock)(UIViewController *viewController, BOOL animated); @@ -285,4 +293,12 @@ - (void)setFd_interactivePopMaxAllowedInitialDistanceToLeftEdge:(CGFloat)distanc objc_setAssociatedObject(self, key, @(MAX(0, distance)), OBJC_ASSOCIATION_RETAIN_NONATOMIC); } +- (void)setFd_shouldSimultaneouslyRecognizeFullScreenPopGesture:(BOOL)fd_shouldSimultaneouslyRecognizeFullScreenPopGesture { + objc_setAssociatedObject(self, @selector(fd_shouldSimultaneouslyRecognizeFullScreenPopGesture), @(fd_shouldSimultaneouslyRecognizeFullScreenPopGesture), OBJC_ASSOCIATION_ASSIGN); +} + +- (BOOL)fd_shouldSimultaneouslyRecognizeFullScreenPopGesture { + return [objc_getAssociatedObject(self, _cmd) boolValue]; +} + @end