View Full Version : UISlider position

Apr 24, 2011, 08:39 AM
I am wondering is there a way to have the ball of a slider move directly to the point that is touched without sliding to that point. For example the ball is on the far left and when I touch down on the right side of the slider, the ball is moved to where I touched.

Apr 25, 2011, 10:21 AM
You'll have to create a custom subclass of UISlider to achieve this. The general flow would be something like:

- Create a custom subclass of UISlider
- Override the touch handling methods
- When a touch down is detected, determine the location of the touch relative to self
- Set the value of self (the UISlider) to the value corresponding to that touch location