Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Background From NSButton

Tags:

swift

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?

like image 981
Eli Avatar asked Mar 20 '16 09:03

Eli


1 Answers

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.
like image 149
MCMatan Avatar answered Nov 15 '22 07:11

MCMatan