You can achieve this by setting the one of the following accessibilityLabel, accessibilityValue, accessibilityHint and accessibilityTrait
.
Assuming the button in question has the text is "Blue OK", and the extra text you want to be read is "2 out of 4"
- By default VoiceOver will read:
"Blue OK" - SHORT PAUSE - "Button"
- Setting the
accessibilityLabel
to "2 out of 4" will result in:
"2 out of 4" - SHORT PAUSE - "Button"
- Setting the
accessibilityValue
to "2 out of 4" will result in:
"Blue OK" - SHORT PAUSE - "2 out of 4" - SHORT PAUSE - "Button"
- Setting the
accessibilityHint
to "2 out of 4" will result in:
"Blue OK" - SHORT PAUSE - "Button" - LONG PAUSE - "2 out of 4"
Note that in this case "2 out of 4" will not get read with a 2 finger swipe down
VoiceOver will announce the object being selected if the button.selected
flag is set to YES
by setting a Trait to it. If you want to add it explicitly to an object that does not support the selected property, you can add the trait yourself:
//can concatenate multiples ones like so UIAccessibilityTraitButton | UIAccessibilityTraitSelected
mybutton.accessibilityTraits = UIAccessibilityTraitSelected;
This trait gets read the same place where the "Button" gets read in the examples above:
"Blue OK" - SHORT PAUSE - "Button, Selected"
If you want the order of wording to be different then you'll need to mix and match the values of accessibilityLabel, accessibilityValue, accessibilityHint and accessibilityTrait
until you get the exact wording you're looking for.