0
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {

    // initialize cell

    if let pickerCell = cell as? SettingsPickerCell {
        collectionView.panGestureRecognizer.requireGestureRecognizerToFail(pickerCell.picker.collectionViewController.collectionView!.panGestureRecognizer)
    }

    return cell
}

The code above works, albeit is as ugly as hell. I have a scrollView buried deep in a view hierarchy, and I need a better way to disable the collection view scrolling when the picker is scrolling.

I tried using the exclusiveTouch property, didn't help. Is there a better way than this?

Mazyod
  • 22,319
  • 10
  • 92
  • 157
  • is this related to [this answer](http://stackoverflow.com/a/26512396/758831)? – wmorrison365 Dec 13 '14 at 00:45
  • @wmorrison365 I don't think so, since my question is an answer to that OP. Also, the solution in looking for could be a better design pattern using the same idea I posted. – Mazyod Dec 13 '14 at 06:13

1 Answers1

1

I think that the best way to subclass your collection view and override

func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) 

and other related methods. There you can control your touch flow and solve your issue.

Nosov Pavel
  • 1,571
  • 1
  • 18
  • 34