How to detect coordinate of UISLDER?
I am using uislider in my application.Now i开发者_C百科 want to get position of center button when i am moving slider.How it possible?
UISlider *slider = mySlider;
CGRect bounds = slider.bounds;
CGRect trackRect = [slider trackRectForBounds:bounds];
CGRect thumbPosition = [slider thumbRectForBounds:bounds trackRect:trackRect
value:slider.value];
See the documentation here.
It's one of the subviews. However, accessing it like this is prone to breakage in future OS versions. You can probably make a reasonable guess of the coordinates with a little math though.
精彩评论