1

I am trying to hide blinking cursor of NSSecureTextField. I have tried

[[passwordField.cell fieldEditorForView:passwordField] setInsertionPointColor:[NSColor clearColor]];

but it is not working.

I have also tried many answers on the question NSTextField - White text on black background, but black cursor but not able to completely hide it.

Community
  • 1
  • 1
Ankur Gupta
  • 110
  • 1
  • 7

1 Answers1

1

This is in Swift, but it worked for me:

    if let cell = secureTextField.cell() as? NSTextFieldCell {
        if let editor = cell.fieldEditorForView(secureTextField) {
            editor.insertionPointColor = NSColor.whiteColor()
        }
    }

Oh I see the only difference is that I use NSColor.whiteColor() instead of clearColor().

Stefan Arentz
  • 34,311
  • 8
  • 67
  • 88
  • white color is working also for me, but i need to hide the cursor with clear color as i have coloured background. – Ankur Gupta Apr 07 '15 at 13:00