开发者

How to detect coordinate of UISLDER?

开发者 https://www.devze.com 2023-01-03 04:42 出处:网络
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;

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消