You can scroll one cell at a time by setting pagingEnabled = YES
. Or for regular scrolling, you can adjust where the deceleration ends by overriding targetContentOffsetForProposedContentOffset:withScrollingVelocity:
of UICollectionViewLayout
. When using the later method, you would typically do the following:
- Determine the nearest index path to
proposedContentOffset
. If there are no gaps between your cells, you can use[UICollectionView indexPathForItemAtPoint:]
. Otherwise, you may have to inspect your layout in some way to determine which index path you want to scroll to. - Determine the frame of the index path you want to scroll to by getting the layout attributes for that index path
- Determine the content offset that will position the given frame where you want it.