I'm using UICollectionView
to generate a image gallery.I used UIImage
inside the UICollectionView
Cell to load the images.I need to select UICollectionView
Cell by Long Press (not by single tap).
- (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];
}
Swift 4
updated answer of it
You can use
LongPressGesture