I am having a collectionview cell which contains scrollview and imageview. currently my collectionview is detecting double tap event but when trying to zoom the image in uicollectionview cell, its not zooming in.
Below is my code for the same.
- (void)tapTwice:(UIGestureRecognizer *)gesture
{
//on a double tap, call zoomToRect in UIScrollView
// Note we need to get location of the tap in the imageView coords, not the imageScrollView
if (gesture.state == UIGestureRecognizerStateEnded)
{
CGPoint point = [gesture locationInView:self.mainProductImageCollectionView];
NSIndexPath *indexPath = [self.mainProductImageCollectionView indexPathForItemAtPoint:point];
if (indexPath)
{
if(mainCell.zoomScrollView.zoomScale > mainCell.zoomScrollView.minimumZoomScale)
[mainCell.zoomScrollView setZoomScale:1.0 animated:YES];
else
[mainCell.zoomScrollView setZoomScale:3.0 animated:YES];
NSLog(@"Image was double tapped");
}
else
{
// DoSomeOtherStuffHereThatIsntRelated;
}
}
}
Any help will be appreciated.
Thanks in advance.