Objective-c – Get keyboard input without a text field/view


I'm making an iPhone application that has my own custom text view that can display multi-formatted text and I need to interact with the keyboard somehow. Right now I am using a hidden UITextField and the delegate method textField:shouldChangeCharactersInRange:replacementString: to get the typed characters. However this feels kludgy and I was wondering if it's possible to show the keyboard and get notified of each key tap without using a UITextField or UITextView?



Best Solution

In the public API, the best you can do is as you described. UIKeyboard and UIKeyboardImpl are both private unfortunately.