Reputation: 121
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
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
Reputation: 12914
This should be enough:
self.collectionView.pagingEnabled = YES;
Swift version:
self.collectionView.pagingEnabled = true
Upvotes: 4