【发布时间】:2013-08-14 06:11:23
【问题描述】:
我正在使用UICollectionView 生成图片库。我在UICollectionView 单元格中使用UIImage 来加载图像。我需要通过长按(而不是单击)选择UICollectionView 单元格。
- (IBAction)longPress:(UILongPressGestureRecognizer *)gestureRecognizer
{
UICollectionViewCell *cell=(UICollectionViewCell *)[gestureRecognizer view];
int index=cell.tag;
OverlayImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height)];
OverlayImage.image = [UIImage imageNamed:@"Overlay@2x.png"];
[cell addSubview:OverlayImage];
}
【问题讨论】:
-
你可以使用
UILongPressGestureRecognizer
标签: iphone ios uicollectionview