Apple's iPod (Music) app has a slider (UISlider, I presume) with variable scrubbing speeds: the further away from the slider you drag vertically, the smaller the proportion of your horizontal dragging speed that is reflected in the value change of the slider. Has anyone figured out how to duplicate this behavior?
Good question that inspired me to find a solution. I created a class named OBSlider that supports variable scrubbing speeds.
The solution in short: subclass UISlider, override -continueTrackingWithTouch:withEvent:
and do the calculation of the change of self.value
depending on the movement of the touch yourself. Thereby, you can freely influence the factor with which you want to multiply the touch movement to get to the new slider value.
For details, please read my blog post: OBSlider, a UISlider subclass with variable scrubbing speed.
Nice work Ole ! I've made some minor modifications to get something more similar to the way iPod app slider's is working when sliding the finger closer to the UISlider ! Basically I handle a variable to track the value corresponding to the finger position, and if the user is getting closer, I apply a different formula (which is not perfect and could be improved a lot).
My fork is available here : http://github.com/sylverb/OBSlider
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With