如何在UICollectionView上禁用多点触摸

我怎样才能禁用UICollectionView多点触摸?

我想同时禁用两个单元格的select。

我试过,但它不工作:

self.collectionView.multipleTouchEnabled = NO; self.collectionView.exclusiveTouch = YES; 

谢谢。

在第一次调用didSelectItemAtIndexPath之后,可以将布尔标志设置为true,如果标志为false(对于方法的第二次调用),则从方法返回。 从显示的视图中返回后,您可以将标志设置为false,以便再次启用单次调用(第一次)。

在你的viewDidAppear设置标志为FALSE(没有触摸已经完成)

然后在你的didSelectItemAtIndexPath

 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { if(self.flag==TRUE){ return; } // This will set the flag to TRUE the first time the method is called self.flag=TRUE; // the rest of your code: display the view } 

假设你已经在你的类中声明了一个标志实例variables。