UITextPosition Class Reference

Inherits from
Conforms to
Available in iOS 3.2 and later.
Declared in


A UITextPosition object represents a position in a text container; in other words, it is an index into the backing string in a text-displaying view.

Classes that adopt the UITextInput protocol must create custom UITextPosition objects for representing specific locations within the text managed by the class. The text input system uses both these objects and UITextRange objects for communicating text-layout information. There are two reasons for using objects for text positions rather than primitive types such as NSInteger:

The simplest of UITextPosition objects—for example, one used in plain text—might have a single integer property that represents an offset into a string. If you adopt the UITextInput protocol, you must create a custom UITextRange subclass as well as a custom UITextPosition subclass.

This class declares no methods of its own.