如何快速解雇UILongPressGestureRecognizer

时间:2014-02-28 05:39:38

标签: ios

我想在按下一个单元格时将其悬停,但按下的时间太长。我尝试将最小按下时间设置为.05,但它不会影响识别器。

任何建议:

if (cell.gestureRecognizers.count==0) {
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(userCellTapped:)];
        [tap setNumberOfTapsRequired:1];


        //add a long press that kills the tap if recognized
        UILongPressGestureRecognizer *press = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(userCellPressed:)];
        [press setMinimumPressDuration:.05];
        [press setNumberOfTouchesRequired:1];

        [press requireGestureRecognizerToFail:tap];

        [tap requireGestureRecognizerToFail:press];
        [cell addGestureRecognizer:tap];
        [cell addGestureRecognizer:press];
    }

0 个答案:

没有答案