iosobjective-cuislider

How to implement a slider whose minimum track is begin from center(value=0) not left


Just something like this. enter image description here

Is there any way that just subclass UISlider can achieve this?

EDIT: Maybe I have misleaded you, but this is quite a UI problem.


Solution

  • Solve it.

    1. create fakeThumbImageView fakeMinTrackImageView fakeMaxTrackImageView and set the frames in thumbRectForBounds:trackRect:value:

    2. override setMinimumTrackTintColor: setMinimumTrackImage: and some other methods(6 in total)

    3. call super setMinimumTrackTintColor:[UIColor clearColor] and so on in initialize method

    4. recommended to make fakeXXXXImageView.layer.zPosition=1000