UITextRange Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 3.2 and later.
Declared in
UITextInput.h

Overview

A UITextRange object represents a range of characters in a text container; in other words, it identifies a starting index and an ending index in string backing a text-entry object.

Classes that adopt the UITextInput protocol must create custom UITextRange objects for representing ranges within the text managed by the class. The starting and ending indexes of the range are represented by UITextPosition objects. The text system uses both UITextRange and UITextPosition objects for communicating text-layout information. There are two reasons for using objects for text ranges rather than primitive types such as NSRange:

If you adopt the UITextInput protocol, you must create a custom UITextRange subclass as well as a custom UITextPosition subclass.

Tasks

Defining Ranges of Text

Properties

empty

A Boolean value that indicates whether the range of text represented by the receiver is zero-length. (read-only)

@property(nonatomic, readonly, getter=isEmpty) BOOL empty
Availability
  • Available in iOS 3.2 and later.
Declared In
UITextInput.h

end

The end of the range of text. (read-only)

@property(nonatomic, readonly) UITextPosition *end
Discussion

Compute and store in this property the UITextPosition object representing the end of a range of text.

Availability
  • Available in iOS 3.2 and later.
Declared In
UITextInput.h

start

The start of a range of text. (read-only)

@property(nonatomic, readonly) UITextPosition *start
Discussion

Compute and store in this property the UITextPosition object representing the start of a range of text.

Availability
  • Available in iOS 3.2 and later.
Declared In
UITextInput.h