Skip to content

Instantly share code, notes, and snippets.

@fastred
Last active March 15, 2019 13:58
Show Gist options
  • Save fastred/3ccd1740e1464dbf8675 to your computer and use it in GitHub Desktop.
Save fastred/3ccd1740e1464dbf8675 to your computer and use it in GitHub Desktop.
Use UIPanGestureRecognizer instead of UIScreenEdgePanGestureRecognizer
// 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);
}
}
}
@fastred
Copy link
Author

fastred commented Jun 1, 2014

@fabb
Copy link

fabb commented Jul 12, 2018

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