Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加fd_shouldSimultaneouslyRecognizeFullScreenPopGesture属性,决定是否同时响应手势 #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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