Search code examples
iosuibuttonuicollectionviewcelluicontrol

Cannot swipe to switch UICollectionView page if you begin gesture on a cell


I have a UICollectionView that contains a single UIButton in each cell. I've discovered it's difficult to swipe between the horizontal pages because if you touch down on a cell to begin the swipe, the UIButton touch events are triggered instead of allowing the swipe gesture to occur. I do have Delays Content Touches enabled for the collection view. What can I do to solve this so that it will recognize the page pan swipe gesture when you begin swiping on a cell? Perhaps the amount of delay can be increased before it recognizes a UIControl event?

Note that I do need to preserve the touch events for the buttons - I need to know when these events occur: TouchDown, TouchDragEnter, TouchCancel, TouchDragExit, and TouchUpInside.


Solution

  • It seems this was only a problem in iOS 8.0 (at least the simulator), as I'm no longer experiencing it in iOS 8.1.