When a editable NSTextField is selected Cocoa marks it as a default by making a blue rectangular around the text field.
But when editing ended the indicator can not be removed unless another text field has been selected.
To remove selection indicator what should we do ?
We are using following function to detect the editing's end.
override func controlTextDidEndEditing(notification: NSNotification) {
// doing things like getting the string user has been made.
}
NSTextField by default draws Focus Ring to show active state. If you want to remove it, you can set t to none.
override func controlTextDidEndEditing(_ obj: Notification) {
textField.focusRingType = .none
}
Note The NSTextField is still the first Responder, If user start typing again, the focus ring will not turn to blue. This is because you have programatically changed it. To get it back, you need to do it yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With