UINavigationController interactivePopGestureRecognizer working abnormal in iOS7
This code can wroks well for me.
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return [gestureRecognizer isKindOfClass:UIScreenEdgePanGestureRecognizer.class];
}
Setting the interactivePopGestureRecognizer.delegate
to self
is only the first step. The second step is to implement
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return !(otherGestureRecognizer is UIPanGestureRecognizer)
}
The test against the pan gesture recognizer is needed to block vertical scrolling of a scroll or table view while the interactive pop is in progress.
Add in Class Controller "UIGestureRecognizerDelegate"
in viewDidAppear add
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
self.navigationController?.interactivePopGestureRecognizer.delegate = self
}
=)