0

I'm trying to create dynamic UICollectionView for my application using code below, the problem is that when i start scrolling from CollectionViewCell it's not scrolling but when i start scroll from outside it works fine.

let flowLayout = UICollectionViewFlowLayout()
flowLayout.scrollDirection = .horizontal
flowLayout.minimumInteritemSpacing = 10
flowLayout.minimumLineSpacing = 10

let collectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: flowLayout)
registerCell(collectionView: collectionView)
collectionView.delegate = self
collectionView.dataSource = self

collectionView.showsVerticalScrollIndicator = false
collectionView.showsHorizontalScrollIndicator = false

_scrollView.addSubview(collectionView)

You can Watch video

CollectionViewCell's properties

enter image description here

2
  • 1
    Are you sure the touch-down event is passed to the collection view (scroll view) correctly? Make sure the cells don't have a custom touch-down event (e.g. tap gesture recognizer, or touchesBegan method without calling the super inside) and also make sure the collection view delays content touches, it's a common mistake to uncheck it and forget it, and then try to understand why a view is not handling touches properly, but its children are. Commented Feb 26, 2020 at 12:28
  • You are right i was using SwipeCollectionViewCell. Thanks :) Commented Feb 26, 2020 at 12:38

1 Answer 1

1

Make sure the cells don't have a custom touch-down event (e.g. tap gesture recognizer, or touchesBegan method without calling the super inside) and also make sure the collection view delays content touches, it's a common mistake to uncheck it and forget it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.