-
-
Save fastred/3ccd1740e1464dbf8675 to your computer and use it in GitHub Desktop.
Use UIPanGestureRecognizer instead of UIScreenEdgePanGestureRecognizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// it's just a proof of concept; there are known problems with this solution | |
- (void)addPanGestureForPopTransitioning | |
{ | |
UINavigationController *navigationController = self.navigationController; | |
NSArray *targets = [navigationController.interactivePopGestureRecognizer valueForKey:@"_targets"]; | |
if ([targets isKindOfClass:[NSArray class]]) { | |
@try { | |
id interactivePanTarget = [[targets firstObject] valueForKey:@"target"]; | |
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:interactivePanTarget action:NSSelectorFromString(@"handleNavigationTransition:")]; | |
[navigationController.view addGestureRecognizer:panRecognizer]; | |
navigationController.interactivePopGestureRecognizer.enabled = NO; | |
} | |
@catch (NSException *exception) { | |
NSLog(@"%@", exception); | |
} | |
} | |
} |
Hm, maybe we could modify the edges
property of UIScreenEdgePanGestureRecognizer
instead.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inspired by A Take on Custom Transitions With UINavigationController.