Eli
Eli

Reputation: 768

Remove Background From NSButton

Hey so i have a table view embeded in a visual effect view, in one of the rows i have a save button and the save button every time i click the cell gets this funky background color around it. enter image description here

Iv tried

saveButton.wantsLayer = true
saveButton.layer?.backgroundColor = NSColor.clearColor.CGColor

but that doesnt work, on the things like labels and stuff the same thing happened but i was able to fix it by setting the background color to a color then turning the opacity all the way down. But because its a button that doesnt work! Any ideas?

Upvotes: 7

Views: 1556

Answers (1)

MCMatan
MCMatan

Reputation: 8843

If someone still gets stuck on this, seems like setting isBordered to false does the trick.

saveButton.wantsLayer = true
saveButton.layer?.backgroundColor = NSColor.clearColor.CGColor

saveButton.isBordered = false // This does the trick.

Upvotes: 3

Related Questions