2

I am using an IBInspectable NSColor property to set the background colour of my view but when I use the colour picker in xcode it lets me initially set the value but then when I go to change any other value on the picker it no longer takes effect.

Only when I reclick the colour picker will it allow me to make futher changes.

Am I missing something here?

Kind Regards

Brian

@IBDesignable class PianoRollGridView: NSView {

    @IBInspectable var backgroundColour: NSColor = NSColor(deviceRed:0.16, green:0.17, blue:0.21, alpha:1.00) {
        didSet {
            layer?.backgroundColor = backgroundColour.cgColor
        }
    }

    required init?(coder: NSCoder) {
        super.init(coder:coder)
        self.wantsLayer = true
    }
}

enter image description here

SacredGeometry
  • 863
  • 4
  • 13
  • 24
  • Yeah, that's curious little Interface Builder idiosyncrasy, isn't it? It looks like when you pick a color for this `@IBInspectable` that the control in IB loses focus. I see this behavior even in Xcode 8.2.1, too. I'd suggest filing a bug report if you haven't already. – Rob Dec 30 '16 at 08:07
  • I will do later, thanks for confirming that it isn't just me. – SacredGeometry Dec 30 '16 at 09:33

0 Answers0