Reputation: 107
I am new to accessibility feature. The problem in my application is that some special characters(. -) are not spoken by the application correctly for example
-0.7 is spelt as 7
Upvotes: 4
Views: 1124
Reputation: 56625
You could use a number formatter and the "spell out" style to create a more suitable accessibilityLabel for those strings. VoiceOver will then read this string for that label but it's not visible in the UI somewhere.
NSNumber *number = @(-0.7);
NSNumberFormatter *formatter = [NSNumberFormatter new];
formatter.numberStyle = NSNumberFormatterSpellOutStyle;
formatter.locale = [NSLocale currentLocale];
NSString *spelledOutNumber = [formatter stringFromNumber:number];
// set that as the accessibility label to be read instead of the number
yourLabel.accessibilityLabel = spelledOutNumber;
That would also give you a solution that works well with different locales (some sample output below):
en_US -> minus zero point seven
de_DE -> minus null Komma sieben
fr_FR -> moins zéro virgule sept
ja_JP -> マイナス〇・七
es_ES -> menos cero coma siete
ru_RU -> минус ноль запятая семь
sv_SE -> minus noll komma sju
Upvotes: 6