I have a CollectionView that have one custom cell.
I want to zoom in/out imageView in cell, so i add pinch gesture at CollectionView.m
when i add gesture to self.collectionView, like this:
[self.collectionView addGestureRecognizer:pinchGesture];
it works! my cell.imageView can zoom in/out, but when i pinch other place(not in cell's imageView, my cell.imageView still zoom in/out with the gesture, I want the cell.imageView zoom in/out just when user pinch the cell.imageView, so i try to add gesture use this code:
[cell.imageView addGestureRecognizer:pinchGesture];
but unfortunately it doesn't work. Nothing happen when i pinch the cell's imageView.
so my question is, is possible to zoom in/out the cell's imageView only when user pinch the cell's imageView? not other place.
Collection view cell
ViewController files
Note : You need to create an IBOutlet for scrollview, image view and collection view from storyboard.
By default, Image view's property
userInteractionEnabled
is set to NO, which disable all gesture recognizers. Setting the property to YES should solve your problemI recommend you to add use scrollview inside cell and image view in scroll view and enable the zoom for the scroll view not for your entire collectionview
i think this will help you