Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 从NSB按钮中删除背景_Swift_Nsbutton - Fatal编程技术网

Swift 从NSB按钮中删除背景

Swift 从NSB按钮中删除背景,swift,nsbutton,Swift,Nsbutton,嘿,我在视觉效果视图中嵌入了一个表视图,在其中一行中,我有一个保存按钮,每次单击单元格时,保存按钮周围都会有一个时髦的背景色。 我试过了 saveButton.wantsLayer = true saveButton.layer?.backgroundColor = NSColor.clearColor.CGColor 但这不起作用,在标签之类的东西上,同样的事情发生了,但我可以通过将背景色设置为一种颜色,然后一直降低不透明度来修复它。但是因为它是一个不起作用的按钮!有什么想法吗?如果有人还

嘿,我在视觉效果视图中嵌入了一个表视图,在其中一行中,我有一个保存按钮,每次单击单元格时,保存按钮周围都会有一个时髦的背景色。

我试过了

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

但这不起作用,在标签之类的东西上,同样的事情发生了,但我可以通过将背景色设置为一种颜色,然后一直降低不透明度来修复它。但是因为它是一个不起作用的按钮!有什么想法吗?

如果有人还在这个问题上纠结,似乎将
isBordered
设置为
false
就能奏效

saveButton.wantsLayer=true
saveButton.layer?.backgroundColor=NSColor.clearColor.CGColor
saveButton.isBordered=false//这就可以了。

按钮中有背景图像吗?没有!我所做的只是将一个UIButton拖放到单元格中,当单元格未被选中时,它不会显示出来,但当它被选中时,它会显示一个可能的副本,该副本对我不起作用