i'm trying to use the interactivepopgesturerecognizer to go back in a view in which i have also a UICollectionView with horizontal scrolling, and the problem is that in the frame of the collection view the swipe to go back doesn't work, but works when the touch begin out of the frame of the collection view, this is an example of my view:
| ---> here works
|-----------
|
| ---> This is the collection view and doesn't swipe to go back
|
|-----------
| ---> here works
how i can solve the problem?
EDIT: i realized that this problem occurs only when in the pushed view the nav bar is hidden, and when is hidden the swipe to go back doesn't work in all view not only in the collection view, and to make it work i need to add this line:
[self.navigationController.interactivePopGestureRecognizer setDelegate:nil];
in the main view, but in this way i can't swipe to go back in the collection view. i have created a simple test to check the problem:
https://www.dropbox.com/s/c7ueyrcmm2x1m5w/TestSwipe.zip?dl=0
Add this line of code to your viewDidLoad method in your SecondViewController
[self.collectionView.panGestureRecognizer requireGestureRecognizerToFail:self.navigationController.interactivePopGestureRecognizer];
This essentially tells the collection view's gesture recognizer that it needs to wait for the interactive pop recognizer to fail before proceeding, forcing the interactive pop to be prioritized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With