首页 文章

UICollectionView:在使用其他手势后未调用didSelectItemAtIndexPath

提问于
浏览
0

我有一个带有 PinchLongPress 手势的 UICollectionViewController . 手势的委托是UICollectionViewController .

加载视图时,如果我选择一个单元格,则会按预期调用didSelectItemAtIndexPath .

但是, if I then Pinch or "LongPress" a cell, now didSelectItemAtIndexPath isn't called anymore .

我的临时解决方案是使用Tap手势识别器替换didSelectItemAtIndexPath,它完美地工作 .

难道没有办法让didSelectItemAtIndexPath工作吗?当UICollectionView已经处理它时,为它添加一个手势是错误的 .

谢谢

1 回答

  • 0

    确保在向视图添加手势识别器之前,请确保将布尔属性"cancelTouchesInView"设置为false . 这可能是因为手势被识别,因此它忽略了对视图的传递触摸,导致不调用单元格选择方法 . Link to property.

相关问题