iOS Reference Library Apple Developer
Search

About Text and Web Support in iOS

iOS gives you many ways to display text in your applications and let users edit that text. It also lets you display web content in your application’s views. The resources at your disposal range from framework objects such as text fields and web views to lower-level technologies that allow your application to draw, lay out, and otherwise manage text.

Note: This document contains information that used to be in iPhone Application Programming Guide and iPad Programming Guide.

image: ../Art/multistage_text.jpg

At a Glance

The UIKit Framework Provides Your Application with Text and Web Objects

Instances of the UITextView, UITextField, and UILabel classes serve as ready-made text views, text fields, and labels that you can add to your application’s user interface. You can add and configure them programmatically or by using the Interface Builder application. A UIWebView object can turn a view of your application into a miniature web browser capable of understanding and displaying HTML, CSS, and JavaScript content

Relevant Chapters: ‚ÄúText Objects and Web Views,‚Äù ‚ÄúDisplaying Web Content‚Äù

When Users Edit Text, Your Application Must Manage the Keyboard

When a user taps a text field, text view, or form field in a web view, iOS animates a keyboard into view. An application can control which keyboard is presented; for example, for a numeric-value field, the application should select the number-pad keyboard. If the entered or edited text is obscured by the keyboard, the application should adjust the view displaying the text so that the text appears above the keyboard. The delegate of a text view, text field, or web view is responsible for validating edited text and for accessing and storing edited text when the user dismisses the keyboard.

Relevant Chapters: ‚ÄúManaging the Keyboard‚Äù

Your Application Can Draw and Manage Text on Its Own

Instead of using the UIKit classes for displaying and and editing text, you could choose to implement an application that does simple text drawing or text input, or even one with its own text layout and management engine. For assistance in text layout and font management, use the Core Text framework. To communicate with the text-input system of iOS, implement the UITextInput protocol and related protocols and classes. Your application can also make use of technologies for spell-checking and regular expressions.

Relevant Chapter: ‚ÄúDrawing and Managing Text‚Äù

See Also

If your application is going to do sophisticated text entry and management, it should use the Core Text technology; read Core Text Programming Guide to learn about Core Text.

The Core Graphics and Core Animation frameworks also have text capabilities. Core Animation, for example, offers the CATextLayer class. To learn more about these capabilities, read Quartz 2D Programming Guide (Core Graphics) and Core Animation Programming Guide.




Last updated: 2010-07-07

Did this document help you? Yes It's good, but... Not helpful...