0
votes

I am developing an iOS app in objective c. For one of the screens I have a horizontal UICollectionView (let's call it collectionView), the cell of which adds a UIView (let's call it myView) as its subview. Both of these views (collectionView and myView) are hosted in a View Controller through an XIB. There is one other UIImageView (let's call it imageView) hosted as a subview in myView. There are a few gestures (pinching, tapping, etc) added to myView which are reflected on the imageView.

I want to add a swipe gesture to one of the views (not sure which one). When a user swipes on the screen, the swipe gesture should be handled by the collectionView (and it should scroll to the next cell). The rest of the gestures defined (pinching, tapping, etc) should be handled by the respective subviews. Any help is much appreciated.

1
The functionality should work in such a way that the swipe gesture should only be recognised by the collectionView and rest of the (pre-existing) gestures on the subviews (imageView, myView) should be recognised by the subviews only. In a way, the user interaction of the subviews should be disabled when the swipe gesture is used, so that it is recognised as a scrollable gesture of collectionView. - Kartik Sethi

1 Answers

0
votes

I am assuming that you want to use swipe gesture to scroll to next cell. You can do that without using the swipe gesture and use the scrolling functionality of collection view. You can also enable the "Paging" property of collection view to scroll one cell at a time. Let me know if this solves your question or you need to implement some other functionality.