From 99fa8ae5acdb38ac1db4e987f583abb84f30c7e7 Mon Sep 17 00:00:00 2001 From: Joshua Feldman Date: Fri, 4 Aug 2017 13:21:27 -0700 Subject: [PATCH 1/5] Changing the default for fd_viewControllerBasedNavigationBarAppearanceEnabled to NO which is what it should be --- .../UINavigationController+FDFullscreenPopGesture.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m index 71871dc..6b82b8d 100644 --- a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m +++ b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m @@ -235,8 +235,7 @@ - (BOOL)fd_viewControllerBasedNavigationBarAppearanceEnabled if (number) { return number.boolValue; } - self.fd_viewControllerBasedNavigationBarAppearanceEnabled = YES; - return YES; + return NO; } - (void)setFd_viewControllerBasedNavigationBarAppearanceEnabled:(BOOL)enabled From 8d2fd040d2dd00d5b562e3e72637ccc8e8be85e0 Mon Sep 17 00:00:00 2001 From: Joshua Feldman Date: Fri, 4 Aug 2017 13:34:14 -0700 Subject: [PATCH 2/5] Code is run even when the property is disabled --- ...UINavigationController+FDFullscreenPopGesture.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m index 6b82b8d..ec5e240 100644 --- a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m +++ b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m @@ -108,12 +108,14 @@ - (void)fd_viewWillDisappear:(BOOL)animated // Forward to primary implementation. [self fd_viewWillDisappear:animated]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - UIViewController *viewController = self.navigationController.viewControllers.lastObject; - if (viewController && !viewController.fd_prefersNavigationBarHidden) { - [self.navigationController setNavigationBarHidden:NO animated:NO]; - } - }); + if (self.fd_viewControllerBasedNavigationBarAppearanceEnabled) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + UIViewController *viewController = self.navigationController.viewControllers.lastObject; + if (viewController && !viewController.fd_prefersNavigationBarHidden) { + [self.navigationController setNavigationBarHidden:NO animated:NO]; + } + }); + } } - (_FDViewControllerWillAppearInjectBlock)fd_willAppearInjectBlock From d89b98e807447367e622044ea18e91fe4648cd5d Mon Sep 17 00:00:00 2001 From: Joshua Feldman Date: Fri, 4 Aug 2017 13:37:27 -0700 Subject: [PATCH 3/5] Fixing a silly mistake --- .../UINavigationController+FDFullscreenPopGesture.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m index ec5e240..d835428 100644 --- a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m +++ b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m @@ -108,7 +108,7 @@ - (void)fd_viewWillDisappear:(BOOL)animated // Forward to primary implementation. [self fd_viewWillDisappear:animated]; - if (self.fd_viewControllerBasedNavigationBarAppearanceEnabled) { + if (self.navigationController.fd_viewControllerBasedNavigationBarAppearanceEnabled) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ UIViewController *viewController = self.navigationController.viewControllers.lastObject; if (viewController && !viewController.fd_prefersNavigationBarHidden) { From 875cf2f6dc4fd37ad13ed770314508b551b68c9c Mon Sep 17 00:00:00 2001 From: Gong Yujun Date: Tue, 8 Aug 2017 23:45:50 +0800 Subject: [PATCH 4/5] Handle the multiple simultaneous pan gesture --- ...igationController+FDFullscreenPopGesture.m | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m index d835428..8cc5038 100644 --- a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m +++ b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m @@ -67,6 +67,27 @@ - (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer return YES; } +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer +shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer +{ + if (gestureRecognizer == self.navigationController.fd_fullscreenPopGestureRecognizer) + { + return YES; + } + return NO; +} + +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer +shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer +{ + if (gestureRecognizer == self.navigationController.fd_fullscreenPopGestureRecognizer || + otherGestureRecognizer == self.navigationController.fd_fullscreenPopGestureRecognizer) + { + return YES; + } + return NO; +} + @end typedef void (^_FDViewControllerWillAppearInjectBlock)(UIViewController *viewController, BOOL animated); From 1c12eacd03f309c7706251a8fd90e0b2571c0f6c Mon Sep 17 00:00:00 2001 From: Andy Gong Date: Thu, 10 Aug 2017 23:17:26 +0800 Subject: [PATCH 5/5] Update the gestures dependency when use the max allowed distance --- .../UINavigationController+FDFullscreenPopGesture.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m index 8cc5038..3d868f2 100644 --- a/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m +++ b/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m @@ -72,6 +72,16 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer { if (gestureRecognizer == self.navigationController.fd_fullscreenPopGestureRecognizer) { + // Ignore when the beginning location is beyond max allowed initial distance to left edge. + UIViewController *topViewController = self.navigationController.viewControllers.lastObject; + CGFloat maxAllowedInitialDistance = topViewController.fd_interactivePopMaxAllowedInitialDistanceToLeftEdge; + + CGPoint beginningLocation = [gestureRecognizer locationInView:gestureRecognizer.view]; + + if (maxAllowedInitialDistance > 0 && beginningLocation.x > maxAllowedInitialDistance) { + return NO; + } + return YES; } return NO;