cocoa-touch - 在处理longPressed笔势时,请禁用UIPageViewController手势识别器,而

  显示原文与译文双语对照的内容
0 0

在网页中,每个页面都包含多个 UIViews,每个页面允许平移手势,但在longPress手势之后,我将使用下面的委托,但它不关心我的限制,并继续翻页 ! 我是否必须在平移时禁用页面转弯? ( 最后一个方法将在PageVC像canTurn一样设置一个变量,然后在移动时将它的设置为。"。"。

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
 if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]] &&
 [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
 return YES;
 }
 return NO;
}
时间:原作者:1个回答

0 0

你应该加上英镑 -gestureRecognizer:shouldReceiveTouch: 在PageVC本身中,或者如果不想在PageVC中添加它,就可以让委托处理它。

就像:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
 if(someCase)
 {
 return yes;
 }
 return no;
}

或者

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
 return [delegate shouldHandle:.....];
}
原作者:
...