How do you stop a UIScrollView at specific point? That is, set the final position of the UIScrollView after user interaction?
Specifically, how can you set intervals along a horizontal UIScrollView, so that the it will only stop at these points?
I hope what I have said is clear enough.
Take a look at method
scrollViewWillEndDragging:withVelocity:targetContentOffset:ofUIScrollViewDelegate. It’s intended to do exactly what you need.The scroll view sends this message to its delegate when the user finishes dragging the scroll view. The third parameter (
targetContentOffset) is passed as a pointer, and you can change its value to change where the scroll view will stop.iOS 5.0 and later.