I have a custom slider that changes value based on super.beginTrackingWithTouch and super.continueTrackingWithTouch. It follows a quadratic path.
Looking to make the custom slider accessible. Any ideas on how to do it?
I was thinking of adding a standard iOS slider, adding accessibilityLabel, and passing those values to the custom slider. Having trouble making the standard slider functional but invisible to the user though.
It's generally best practice to extend a standard control to perform the special behavior you need. As author of a completely custom control, you're responsible for more of its accessibility.
Experiment with a
UISliderusing VoiceOver on your device. See how it behaves. You want to maintain as much of this experience as possible as you implement your own control. You can use Accessibility Inspector in Simulator to explore system controls' accessibility configurations.The following steps are almost certainly relevant:
- (BOOL)isAccessibilityElementto returnYES.- (CGRect)accessibilityFrameto return an appropriate rectangle in screen coordinates.- (UIAccessibilityTraits)accessibilityTraitsto includeUIAccessibilityTraitAdjustable.- (NSString *)accessibilityValueto describe the current value of your control.- (void)accessibilityIncrementand- (void)accessibilityDecrementto perform value changes requested by assistive clients such as VoiceOver.Beyond the steps above, I can't say what's required for your specific control without more details. If you get stuck, review the Accessibility Programming Guide, UIAccessibility Protocol documentation, and UIAction protocol documentation, and return to StackOverflow with any questions that remain.
Best luck and thank you for giving this the attention it deserves.