UILongPressGestureRecognizer .minimumPressDuration不在iOS9上进行woking

时间:2015-09-23 12:13:47

标签: ios uigesturerecognizer ios9 uitapgesturerecognizer

我已经尝试了一切,似乎没有任何工作,
在代码中添加UILongPressGestureRecognizer

UILongPressGestureRecognizer *lpOnView = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
lpOnView.minimumPressDuration = 1.0; //seconds
lpOnView.delegate = self;
[tblView addGestureRecognizer:lpOnView];

UILongPressGestureRecognizer *lpOnView = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; lpOnView.minimumPressDuration = 1.0; //seconds lpOnView.delegate = self; [tblView addGestureRecognizer:lpOnView]; 和handle方法看起来像

-(void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer {
  if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) {
    NSLog(@"UILongPressGestureRecognizer");
  } else {
    NSLog(@"other gesture");
  }
  if ([self.tableView.gestureRecognizers containsObject:gestureRecognizer]){
    switch (gestureRecognizer.state) {
        case UIGestureRecognizerStatePossible:
            NSLog(@"UIGestureRecognizerStatePossible");
            break;
        case UIGestureRecognizerStateBegan:
            NSLog(@"UIGestureRecognizerStateBegan");
            break;
        case UIGestureRecognizerStateChanged:
            NSLog(@"UIGestureRecognizerStateChanged");
            break;
        case UIGestureRecognizerStateEnded:
            NSLog(@"UIGestureRecognizerStateEnded");
            break;
        case UIGestureRecognizerStateCancelled:
            NSLog(@"UIGestureRecognizerStateCancelled");
            break;
        case UIGestureRecognizerStateFailed:
            NSLog(@"UIGestureRecognizerStateFailed");
            break;
        default:
            break;
    }
  }
}
录制tableView单元格会导致。 -(void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer { if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) { NSLog(@"UILongPressGestureRecognizer"); } else { NSLog(@"other gesture"); } if ([self.tableView.gestureRecognizers containsObject:gestureRecognizer]){ switch (gestureRecognizer.state) { case UIGestureRecognizerStatePossible: NSLog(@"UIGestureRecognizerStatePossible"); break; case UIGestureRecognizerStateBegan: NSLog(@"UIGestureRecognizerStateBegan"); break; case UIGestureRecognizerStateChanged: NSLog(@"UIGestureRecognizerStateChanged"); break; case UIGestureRecognizerStateEnded: NSLog(@"UIGestureRecognizerStateEnded"); break; case UIGestureRecognizerStateCancelled: NSLog(@"UIGestureRecognizerStateCancelled"); break; case UIGestureRecognizerStateFailed: NSLog(@"UIGestureRecognizerStateFailed"); break; default: break; } } }

为什么Tap执行此事件,它应至少等待一秒钟才能执行?

这个开始在iOS9上发生,在iOS8上工作正常。

1 个答案:

答案 0 :(得分:0)

我知道我回答了自己的问题,这是为了帮助那些有同样问题的人。
更新Infragistics Nuclios 2014 vol。 1到卷2解决了这个问题。所以它不是iOS9的问题,而是第三方框架。