Mit Variance
Mit Variance

Reputation: 15

How do i disable vertical scrolling but enable horizontal scrolling in collectionview swift 4?

when I disable scrolling. It disabled for both horizontal and vertical. how do I disable scroll for only vertical only? settings for collectionview

Upvotes: 0

Views: 1882

Answers (1)

udbhateja
udbhateja

Reputation: 978

It's not possible to scroll collectionView in both directions. Either it will scroll horizontally or vertically.

User scrollDirection to specify your desired scroll direction.

if let flowLayout = collectionView.collectionViewLayout as?  UICollectionViewFlowLayout {
    flowLayout.scrollDirection = .horizontal
    flowLayout.scrollDirection = .vertical
}

Upvotes: 1

Related Questions