A text view (UITextView) is sort of a scrollable, multiline version of a text field (UITextField, with which it should not be confused). It is a scroll view subclass (UIScrollView, Chapter 20), and thus has (by default) no border; it is not a control. It has
textAlignment properties; it can be editable or not, according to its
editable property. (You might use a scrollable noneditable text view instead of a UILabel, so as not to be limited to a fixed number of lines of text.) An editable text view governs its keyboard just as a text field does: when it is first responder, it is being edited and shows the keyboard, and it implements the UITextInput protocol and has
inputAccessoryView properties. Its menu works the same way as a text field’s.
One big difference, from the programmer’s point of view, between a text view and a text field is that a text view gives you information about, and control of, its selection: it has a
selectedRange property which you can get and set, and it adds a
scrollRangeToVisible: method so that you can scroll in terms of a range of its
selectedRange is useful especially if the text view is first responder, because the selection is then meaningful and visible, but it does work (invisibly) even if the text view is not first responder. (You could take advantage of the
selectedRange, for example, to customize a text view’s menu with more intelligence than in our text field example in the previous ...