开发者

Use UISlider without user interaction

开发者 https://www.devze.com 2023-03-08 06:13 出处:网络
I\'ve got a customized UISlider that I want to use to display information to the user with and I don\'t want the user to be able to interact with the slider. I\'ve tried

I've got a customized UISlider that I want to use to display information to the user with and I don't want the user to be able to interact with the slider. I've tried

mySlider.enabled = NO;

but the slider beco开发者_JS百科mes greyed out, which does not look the way I want it to look.

So, how do I set a UIControl to disabled without "greying" it out.


mySlider.userInteractionEnabled = NO;


Don't you think it's going to confuse users to present an enabled slider that doesn't respond to touches? A UISlider doesn't just display information, it also tells the user that the information is user-adjustable.

You should come up with your own information display that doesn't look user-adjustable.


userInteractionEnabled probably doesn't works for the UISlider (and why it exists??) but it works for its superview. So, try attaching the UISlider to another auxiliary (transparent?) NSView and then set userInteractionEnabled = NO to this auxiliary view.

0

精彩评论

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

关注公众号