问题
I am using voice over on checkbox.
The issue I am facing here is, when user selects the checkbox for the first time it says 'checkbox selected' (which is correct as per accessibilityLabel set) but next time when user tries to de-select it says 'checkbox selected, checkbox de-selected' where it should only say 'checkbox de-selected', vice-a-versa.
So what is happening here is that, the previously set accessibilityLabel is not getting cleared up and when user tries to select or de-select it takes the both previous and currently set label.
Note- using custom checkbox, toggling UIButton with selected/de-selected image.
How to solve this conflict?
回答1:
If you create your checkbox thanks to a UIButton
item, I suggest to :
- Untick the button
UIAccessibilityTraits
. - Provide a clear hint when the checkbox is first selected : "double tap to change the value".
- Update your button accessibility label thanks to
IBAction
when the box is toggled.
However, it's always better to create a UIAccessibilityElement
that contains your check box and a label that describes what it refers to ⟹ when you double tap this accessible wrapper with one finger, the checkbox value toggles and your initial problem disappears.
Following these steps will provide an appropriate user experience with no checkbox VoiceOver conflict that you noticed.
来源:https://stackoverflow.com/questions/52857383/ios-uiaccessibility-voice-over-with-checkbox-is-not-working-properly