harigharan
harigharan

Reputation: 121

How to scroll only one cell In UICollectionview while swiping the Cell?

I am displaying the 3 cells at the same time in UICollectionView. How to force the user to horizontally scroll only one item at a time in UICollectionView?

Upvotes: 2

Views: 4355

Answers (2)

veeresh kumbar
veeresh kumbar

Reputation: 805

If you want your cells to be moved only one at a time then you need to set the frame of cell equals to the collection view and then set the collectionView's paging enabled as below,

[collectionView setPagingEnabled:YES];    

or

collectionView.pagingEnabled=YES;

Upvotes: -2

KlimczakM
KlimczakM

Reputation: 12914

This should be enough:

self.collectionView.pagingEnabled = YES;

Swift version:

self.collectionView.pagingEnabled = true

Upvotes: 4

Related Questions