Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Text can be displayed in various ways:
UILabel
Displays text, possibly consisting of multiple lines, in a single font and size, with color (and highlighted color), alignment, and wrapping and truncation. Discussed in this chapter.
UITextField
Displays a single line of editable text, in a single font and size, with color and alignment; may have a border, may have a background image, and overlay views may appear at its right and left end. Discussed in this chapter; a UITextField is a UIControl subclass, so see also Chapter 25.
UITextView
Displays scrollable text, possibly editable, in a single font and size, with color and alignment; can use data detectors to display tappable links. Discussed in this chapter.
UIWebView
A scrollable view displaying rendered HTML. Because HTML can express text attribute spans, this is a good way to show text in multiple fonts, sizes, colors, alignments, and so on, and to include images and tappable links. Can also display various additional document types, such as PDF, RTF, and .doc. Discussed in the next chapter.
Drawing
There are three main ways to draw strings directly:
Core Graphics
Low-level methods for drawing text (not NSStrings). For drawing in general, see Chapter 15.
NSString
At a high level, the UIStringDrawing category on NSString endows strings with the ability to draw themselves, along with metrics methods (the sizeWithFont... methods) for learning the dimensions at which a given string will be drawn. NSString drawing methods are not complicated, and examples have already appeared in this book without special comment (for example, in Chapter 12 and Chapter 20).
Core Text
The only way in iOS (added in iOS 3.2) to draw strings with multiple fonts and styles. Core Text also provides access to advanced font typographical features. Discussed in this chapter.