4

I have a UITextField that contains "£24 pm" but I want voiceover to say "£24 per month". By setting:

[textView setAccessibilityLabel:@"£24 per month"];

VoiceOver reads out "£24 per month £24 pm".

How do I stop the message in the UITextField from being read out?

Royston Yinkore
  • 561
  • 1
  • 8
  • 22

2 Answers2

4

You should set the accessibility label to describe the text field (as if it was a key) and the accessibility value for its value.

textField.accessibilityLabel = NSLocalizedString(@"Price", nil);
// textField.accessibilityValue = @"£24 per month";
textField.accessibilityValue = [self transformedPrice:textField.text];

-transformedPrice: should do whatever operation to transform the actual text in your textField to what should be used in voice over. (Don't forget localization)

Moxy
  • 4,162
  • 2
  • 30
  • 49
1

Set the accessibilityValue to nil or a blank string and the accessibilityLabel to @"£24 per month".

Borys Verebskyi
  • 4,160
  • 6
  • 28
  • 42