Instance Method

textView:shouldChangeTextInRange:replacementString:

Sent when a text view needs to determine if text in a specified range should be changed.

Declaration

- (BOOL)textView:(NSTextView *)textView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString;

Parameters

aTextView

The text view sending the message. This is the first text view in a series shared by a layout manager, not necessarily the text view displaying the selected text.

affectedCharRange

The range of characters to be replaced.

replacementString

The characters that will replace the characters in affectedCharRange; nil if only text attributes are being changed.

Return Value

YES to allow the replacement, or NO to reject the change.

Discussion

If a delegate implements this method and not its multiple-selection replacement, textView:shouldChangeTextInRanges:replacementStrings:, it is called with an appropriate range and string. If a delegate implements the new method, then this one is ignored.

See Also

Setting Text Attributes

- textView:shouldChangeTextInRanges:replacementStrings:

Sent when a text view needs to determine if text in an array of specified ranges should be changed.

- textView:shouldChangeTypingAttributes:toAttributes:

Sent when the typing attributes are changed.

- textViewDidChangeTypingAttributes:

Sent when a text view’s typing attributes change.