UISlider, knowing thumbImage position [duplicate]
Is there a way to display the Slider value over the ThumbImage?
I was thinking of getting the X position of the ThumbImage and then moving a UILabel accordingly. Is that possible?Unfortunately, you have to do this yourself. I did something like it for shakedown. As you can see there, I put a UILabel above the slider so that the user could see as they manipulated.
Luckily, it's pretty easy to do. Simply send the slider a message like addTarget:action:forControlEvents:, with a method you create as the "action" parameter. This method will then get called whenever the thumb is moved (depending on your forControlEvents value). Inside of that method, check the UISlider's value property and update the UILabel accordingly.
精彩评论