title: Accessible Custom Keyboard in iOS
body: <p>I want to make a custom keyboard perform like the iOS software keyboard with regards to accessibility. When a button-press adds a letter to a UITextField, the letter should be spoken by VoiceOver in the ‘added character tone‘. When a button-press deletes a letter from a UITextField, the letter should be spoken by VoiceOver in the ‘deleted character tone’.</p>
  
  <p>Here is what I attempted:</p>
  
  <ol>
  <li>Created a UITextField in the view controller, in the storyboard.</li>
  <li>Created two UIButtons labeled ‘Type’ and ‘Backspace’ in the view controller, in the storyboard.</li>
  <li>Set the accessibility traits for both UIButtons to Keyboard Key.</li>
  <li>Hooked the storyboard UITextField up to an IBOutlet UITextField instance, textField.</li>
  <li>Hooked the storyboard ‘Type’ UIButton up to an IBAction, -type.</li>
  <li>Hooked the storyboard ‘Backspace’ UIButton up to an IBAction, -backspace.</li>
  <li>Implemented -type as: <code>[[self textField] insertText:@"a"];</code>.</li>
  <li>Implemented -backspace as: <code>[[self textField] deleteBackward];</code>.</li>
  <li>Made textField the first responder.</li>
  </ol>
  
  <p>I also tried the same thing, moving the buttons into a UIView that was set as textField’s inputView.</p>
  
  <p>The characters are properly added to and removed from the text field, but they are not spoken by VoiceOver. How can I make this work?</p>
  
  <p><strong>EDIT:</strong><br>
  The hardware keyboard speaks correctly. It is only the custom software keyboard that is not speaking as it should.</p>