Is it possible to change the 'gravity' (stop speed) when scrolling through a UIScrollView
with paging enabled? I've implemented a horizontal UIScrollView
that acts like the UIPickerView
. I want to be able to scroll through many items based on the flick speed. Thanks!
Asked
Active
Viewed 1,129 times
1

Community
- 1
- 1

Kevin Sylvestre
- 37,288
- 33
- 152
- 232
1 Answers
1
Unfortunately there's no simple property you can change to achieve this, but you can use the scrollview delegate methods to roll your own (it is somewhat complex, but achievable - I've modified table views to 'snap' to rows when the scrolling comes to an end).
Effectively, you'll have to code your own paging implementation.

lxt
- 31,146
- 5
- 78
- 83
-
@Ixt Which delegate methods would you use to perform this? Is it possible to be notified when a scroll view scrolling speed reaches a certain point? The only delegates available I see are `scrollViewWillBeginDecelerating` and `scrollViewDidEndDecelerating` (the first is too soon and the last is too late). Thanks! – Kevin Sylvestre Feb 11 '11 at 22:39
-
You've also got `scrollViewDidScroll`, which despite the slightly misleading name, gets called _continuously_, and `scrollViewDidEndDragging:willDecelerate`. You can use these (along with the methods you've already mentioned) to calculate the speed of the scroll, and when the finger has been lifted from the screen. This will let you 'page' to the nearest item but still let the user flick through items very quickly (rather than one at a time). It's not the simplest thing in the world to code, but definitely achievable. – lxt Feb 12 '11 at 16:58
-
@Ixt Thanks, This sounds a bit too complicated for me to implement so I might need to look for a workaround. Appreciate the answer! – Kevin Sylvestre Feb 18 '11 at 02:12