NSTextField draws white area after resigning first responder

126 views Asked by At

I got an NSTextField that looks just fine until it resigns the first responder.

enter image description here

It draws a white rectangle until it becomes the first responder again. Any idea how to avoid this?

1

There are 1 answers

1
floschliep On

The drawing issue seems to be caused by the TextField's cell and not by the TextField itself. This weird workaround fixes the issue:

class TextFieldCell: NSTextFieldCell {

    override func drawInteriorWithFrame(cellFrame: NSRect, inView controlView: NSView) {
        super.drawInteriorWithFrame(cellFrame, inView: controlView)
    }

}