I have a view controller which is nested within a UINavigationController
.
I have implemented the iOS 7 interactivePopGestureRecognizer to enable the user to
I used this.
self.navigationController.interactivePopGestureRecognizer.delegate = self;
also in my UINavigationController class to disable interactivePopGestureRecognizer during transitions.
- (void)pushViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.interactivePopGestureRecognizer.enabled = NO;
}
[super pushViewController:viewController animated:animated];
}
- (void)navigationController:(UINavigationController *)navigationController
didShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
if ([navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
// disable interactivePopGestureRecognizer in the rootViewController of navigationController
if ([[navigationController.viewControllers firstObject] isEqual:viewController]) {
navigationController.interactivePopGestureRecognizer.enabled = NO;
} else {
// enable interactivePopGestureRecognizer
navigationController.interactivePopGestureRecognizer.enabled = YES;
}
}
}
the reason of disable interactivePopGestureRecognizer in rootViewController is:when swipe from edge in rootViewController and then tap something to push in next viewController, the UI won't accept any touches now.Press home button to put app in background , and then tap it to enter foreground...