UISlider accessibility traits for VoiceOver?

戏子无情 提交于 2019-12-06 09:27:02

Here's what I ended up adding to a UISlider for VoiceOver accessibility:

[ mySlider setIsAccessibilityElement:YES ];
[ mySlider setAccessibilityLabel:@"This slider controls blah blah etc...." ];

And in the target method for the control event UIControlEventValueChanged:

[ mySlider setAccessibilityValue = [ NSString stringWithFormat:@"Blah blah is set to %3.1f", mySlider.value];

With VoiceOver enabled, this slider then spoke the new value as I swiped up and down (not back and forth) over it after setting the focus to that slider.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!