NSTextField - White text on black background, but black cursor

后端 未结 9 1066
温柔的废话
温柔的废话 2020-12-14 16:23

I\'ve setup an NSTextField with text color as white, and the background color as (black despite not rendering the background color, so its transparent). All in

9条回答
  •  遥遥无期
    2020-12-14 16:54

    Swift 4 Solution

    override func viewDidAppear() {
        super.viewDidAppear()
        guard let window = _textField.window, let fieldEditor = window.fieldEditor(true, for: _textField) as? NSTextView else { return }
        fieldEditor.insertionPointColor = .white
    }
    

提交回复
热议问题