7

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?

Eli
  • 668
  • 2
  • 13
  • 37
  • Is there any background image in your button? – ridvankucuk Mar 20 '16 at 09:32
  • nope! All i did was drag an drop a UIButton into the cell, it doesnt show up when the cell isnt selected but when it is selected it shows up – Eli Mar 20 '16 at 09:47
  • Possible duplicate of [NSButton on NSVisualEffectView: Wrong Background Color](http://stackoverflow.com/questions/30659384/nsbutton-on-nsvisualeffectview-wrong-background-color) – Ky - Dec 09 '16 at 20:22

1 Answers1

3

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.
Paulo Mattos
  • 18,845
  • 10
  • 77
  • 85
MCMatan
  • 8,623
  • 6
  • 46
  • 85