Question

UIThumbWheel

I'm developing a wheel, like an old fashioned volume control, that sticks out of the side of a UIView and returns values. The issue I'm having is how to marry UIScrollView to the task while having the knob accelerate based upon the users speed of scrolling. For clarity my mock-up of the wheel would look like this.

Thumb wheel

I have create a UIScrollView that removes and add subviews to make the wheel. The issue I'm having is making the wheel control adjust the size of the returned values based upon the speed the user is spinning the wheel. The values of the three speed profiles should add to the sum total, slow (+500), medium (+1000), and fast (+10000). In order to maintain the rubber-banding at zero and the upper-bound I am using the contentOffset for display values.

When I try to manipulate the scrollView.bounds, or contentOffset by adding the movement based upon speed I end up with a stuttery experience. If I ignore the contentSize window, a la infinite scrolling, I lose the rubber-banding values.

Does anyone know how to get both speed-based movement and rubber-banding ends?

Was it helpful?

Solution

This is a nice little challenge you're facing with this, i like that! :) Right now I'm developing something similar, sort of an rotational wheel like control with inertia spin and "rubber-banding" when reaching a certain threshold etc.!

If i got you right, you're using a UIScrollView for your control AND you're trying to use/abuse the already existing bouncing "feature" of the UIScrollView right? Do you have a problem with calculating the speed values based on the scrolling speed or does the kicking-in rubber-banding causing problems?

Did you consider implementing the rubber-banding effect on your own, via "touchesBegan.."/"touchesMoved"? Mimicking the rubber-banding is quite simple: from a certain threshold value on the on-screen movement of the view would be half the finger-drag movment until total stop. see also: Mimicking the "rubber band" effect from iOS in the Gallery on Android

You could also check out the implementation of iCarousel maybe. It has similar "rubber-banding" effects custom programmed.

I know this is not an satisfying response/answer, but maybe it points your thoughts into some other direction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top