Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Many months ago, I spent some time updating the open-source iOS BOCHS emulator build to allow it to work with keyboard entry. The default code allowed touch-based “mouse” interactions but didn’t offer any keyboard support. After a little investigation, I discovered and then implemented the UIKeyInput protocol. This simple protocol, when added to a little first responder manipulation, allows you to update any view to offer text input.
Recipe 10-6 illustrates how to transform a standard UIToolbar into a view that accepts keyboard entry, letting users type text directly into the toolbar, as shown in Figure 10-8. As the user types, the toolbar text updates, even properly handling the delete key.
Figure 10-8. Adding the UIKeyInput protocol to a toolbar transforms the view into one that can accept and display keyboard input, including deletions.