我想在双击collectionview
单元格时发生一个事件
UIGestureRecognizer
是解决此问题的唯一方法吗?
这是我需要解决的非常漫长而艰难的代码...
UICollectionView
或UICollectionViewCell
是否有任何支持?
答案 0 :(得分:0)
在你的-cellForRowAtIndexPath中:
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(doubleTapped:)];
tap.numberOfTapsRequired = 2;
[cell addGestureRecognizer:tap];
这个方法:
-(void)doubleTapped:(UITapGestureRecognizer*)tap{
UICollectionViewCell *doubleTappedCell = tap.view;
NSIndexPath *indexPath = [self.collectionView indexPathForCell:doubleTappedCell];
}