Chapter 13. Handling Text Input

In This Chapter

Learning how to work with text input and text fields
Configuring the on-screen keyboard
Understanding UITextInputTraits
Handling keyboard events with a delegate

Most applications allow some kind of textual input to be used with them. Whether it's text, telephone numbers, or whatever, more than likely during your career as an iPhone app developer you're going to need to work with text input.

Another of the unique features of the iPhone is its on-screen keyboard. Using it, the iPhone can be adapted to display different kinds of alphabets, symbols, and so forth. The text system that provides this keyboard has a variety of capabilities that can be utilized by developers, allowing them to select the kind of capitalization, the kind of letters displayed, and the type of auto correction to use, among other things.

In this chapter, you're going to take a look at how you can configure the keyboard, both through Interface Builder and through code. You're also going to look at how you handle events that occur with the keyboard, such as when the text changes or when the user is finished editing. When you're finished, you will have a solid grasp of how to work with text with your iPhone applications.

Configuring the Keyboard through Interface Builder

There are two UI components in Cocoa Touch that are designed specifically for handling text entry: UITextField and UITextView. UITextField is designed to handle a single-line entry of text and UITextView is ...

Get Cocoa Touch™ for iPhone® OS 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.