I create ClothesCollectionView
that contains ClothesCollectionViewCell
elements. One of the element is called JeansCollectionViewCell
and is a collectionView
on its own. This image probably makes it easier to understand
1 is ClothesCollectionView
, 2 is JeansCollectionViewCell
and 3 are cell on JeansCollectionViewCell
called JeanItemCell
.
When a JeanItemCell
is selected, the delegate didSelectItemAt
of ClothesCollectionView
gets called but not the one of JeansCollectionViewCell
, so I can not determine which JeanItemCell
was selected.
EDIT:
I added this code found here to JeansCollectionViewCell
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let hitTargetView = super.hitTest(point, with: event)
return hitTargetView as? UIControl ?? (hitTargetView == self ? nil : superview)
}
override func didMoveToSuperview() {
superview?.addGestureRecognizer(collectionView.panGestureRecognizer)
}
Now, with this code, I am able to scroll horizontally on JeansCollectionViewCell which was not the case, but unfortunately also outside the cell. Everywhere from ClothesCollectionView I can scroll horizontally the Jeans items. I am still not able to detect taps on the items.