Swift 3 macOS,设置默认按钮样式

时间:2017-12-07 14:58:04

标签: swift macos nsbutton

当我创建新的NSButton时,如何将其设置为默认样式?

let (nomplusbut) = NSButton(frame: CGRect(x: 200, y: iy, width: 300, height: 40))
(nomplusbut).title = "Pfad öffnen..."
(nomplusbut).target = (self, action: #selector(buttonAction)) as AnyObject?
(nomplusbut).isBordered = true
(nomplusbut).setButtonType(NSMomentaryPushInButton)

arraybut.append(nomplusbut)

print(array[array.count - 1].stringValue)
self.view.addSubview(arraybut[arraybut.count - 1])

我希望拥有的风格:

button with default style

当前风格:

button with current style

1 个答案:

答案 0 :(得分:0)

您应该将按钮bezelStyle更改为rounded,例如:

nomplusbut.bezelStyle = .rounded