Instance Method

textDidEndEditing(_:)

Handles an end of editing.

Declaration

func textDidEndEditing(_ notification: Notification)

Parameters

aNotification

The notification that editing has ended.

Discussion

After validating the new value, posts an textDidEndEditingNotification to the default notification center. This posting causes the receiver’s delegate to receive a controlTextDidEndEditing(_:) message. After this message, sends endEditing(_:) to the receiver’ cell and handles the key that caused editing to end:

  • If the user ended editing by pressing Return, this method tries to send the receiver’s action to its target; if unsuccessful, it sends performKeyEquivalent(with:) to its NSView (for example, to handle the default button on a panel); if that also fails, the receiver simply selects its text.

  • If the user ended editing by pressing Tab or Shift-Tab, the receiver tries to have its NSWindow object select its next or previous key view, using the NSWindow method selectKeyView(following:) or selectKeyView(preceding:). If unsuccessful in doing this, the receiver simply selects its text.

See the NSControl class specification for more information on the text delegate method.

See Also

NSText Delegate Method Implementations

func textShouldBeginEditing(NSText) -> Bool

Requests permission to begin editing a text object.

func textDidBeginEditing(Notification)

Posts a notification that the text is about to begin editing to the default notification center.

func textDidChange(Notification)

Posts a notification that the text has changed and forwards this message to the receiver’s cell if it responds.

func textShouldEndEditing(NSText) -> Bool

Performs validation on the receiver’s new value.