Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The iPad comes with a built-in virtual keyboard, but it only displays its keyboard when a user taps in a text field. Short of going native, there is no way to show the keyboard and capture keystrokes on the iPad if your application lets users enter text without tapping in a text field. In fact, the paint application discussed in this chapter and throughout this book is just such an application. After you activate the text icon, you can click anywhere in the drawing canvas, and a cursor will appear. Subsequently you can type—provided that you have a keyboard—and the paint application draws the text, as depicted in Figure 11.11.
Figure 11.11. Entering text in the paint application
Because iOS5 only shows the keyboard when a user physically taps into a text field—programmatically giving a text field focus does not show the keyboard—most developers are stuck if they are developing an application that has an alternate text input strategy. However, for developers familiar with Canvas, it’s possible to implement your own keyboard and show it yourself. The next section illustrates how to do that.