Hello everyone,
I have a custom keyboard app and currently am working on a voice over support update, but am having an issue with the delete (backspace) button.
My keyboard is now working exactly like the apple default keyboard with Voice Over in "Touch Typing" mode. When the user taps on w, a, s then space, VoiceOver will say "was" after the space button is tapped. Myb only issue is with the delete key, when the user taps on it, VoiceOver says "Bottom of documnet" rather than the deleted character. I have tried many different ways to allow VoiceOver to speak the deleted word, but no luck.
My delete key' accessibilityTraits is set to
button.accessibilityTraits = UIAccessibilityTraitKeyboardKey
just like the other keys in the keyboard, but that is not helping.
What I need is for VoiceOver to say what is being deleted when the delete key is pressed just like the Apple keyboard does wit VoiceOver.
Many thanks
Hassan
I was able to figure out the solution for this issue.
First of all I used the
UIAccessibilityAnnouncementNotification
which will be called when the delete button is pressed and will pass the deleted character to it as a parameter.
We find the deleted character by using
textDocumentProxy.documentContextBeforeInput
this will return a string and all you need to do is to get the last character.
Done!!!!! Easy solution for an annoying issue.