Reputation: 2295
I have a vertically scrolling UICollectionview with different elements. In one section, I would like to show multiple horizontally scrollable elements. This is how my setup looks like:
A Prototype Cell (subclass of UICollectionViewCell):
class SlidingCollectionViewCell: UICollectionViewCell, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return 2
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 8
}
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return CGSizeMake(130, 100)
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
return collectionView.dequeueReusableCellWithReuseIdentifier("SwipeContainedCell", forIndexPath: indexPath) as! UICollectionViewCell
}
}
Whatever I do, it just doesn't scroll horizontally :-(. What am I doing wrong?
Upvotes: 1
Views: 683
Reputation: 146
make sure that you don't have the nested CollectionView inside an UIView
Upvotes: 1