我想实现后退导航,使用长按并向左滑动,而不抬起手指,但如果我在长按后不抬起手指,则无法识别滑动手势。
我还实现了以下委托方法,但没有出现所需的结果。有什么想法吗?
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if (gestureRecognizer == _longPress && otherGestureRecognizer == _swipe) {
return YES;
}
if (gestureRecognizer == _swipe && otherGestureRecognizer == _longPress) {
return YES;
}
return NO;
编辑: - 长按手势触发方法,该方法更改当前 UIViewController 的背景颜色(制作它,只是为了看看它是否触发)。-滑动手势触发方法,-popViewController:animated