UISlider position

Discussion in 'iOS Programming' started by nickculbertson, Apr 24, 2011.

  1. nickculbertson macrumors regular


    Nov 19, 2010
    Nashville, TN
    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.
  2. ppilone macrumors 6502

    Jan 20, 2008
    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

Share This Page