Protocol

UITextViewDelegate

The UITextViewDelegate protocol defines a set of optional methods you can use to receive editing-related messages for UITextView objects. All of the methods in this protocol are optional. You can use them in situations where you might want to adjust the text being edited (such as in the case of a spell checker program) or modify the intended insertion point.

Symbols

Responding to Editing Notifications

func textViewShouldBeginEditing(UITextView)

Asks the delegate if editing should begin in the specified text view.

func textViewDidBeginEditing(UITextView)

Tells the delegate that editing of the specified text view has begun.

func textViewShouldEndEditing(UITextView)

Asks the delegate if editing should stop in the specified text view.

func textViewDidEndEditing(UITextView)

Tells the delegate that editing of the specified text view has ended.

Responding to Text Changes

func textView(UITextView, shouldChangeTextIn: NSRange, replacementText: String)

Asks the delegate whether the specified text should be replaced in the text view.

func textViewDidChange(UITextView)

Tells the delegate that the text or attributes in the specified text view were changed by the user.

Responding to Selection Changes

func textViewDidChangeSelection(UITextView)

Tells the delegate that the text selection changed in the specified text view.

Interacting with Text Data

func textView(UITextView, shouldInteractWith: NSTextAttachment, in: NSRange, interaction: UITextItemInteraction)

Asks the delegate if the specified text view should allow the specified type of user interaction with the provided text attachment in the given range of text.

func textView(UITextView, shouldInteractWith: NSTextAttachment, in: NSRange)

Asks the delegate if the specified text view should allow user interaction with the provided text attachment in the given range of text.

Deprecated
func textView(UITextView, shouldInteractWith: URL, in: NSRange, interaction: UITextItemInteraction)

Asks the delegate if the specified text view should allow the specified type of user interaction with the given URL in the given range of text.

func textView(UITextView, shouldInteractWith: URL, in: NSRange)

Asks the delegate if the specified text view should allow user interaction with the given URL in the given range of text.

Deprecated