Swift 3 macOS,设置默认按钮样式
Swift 3 macOS, set default button style
创建新 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])
我想要的风格:
当前样式:
您应该将按钮的 bezelStyle
更改为 rounded
,例如:
nomplusbut.bezelStyle = .rounded
创建新 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])
我想要的风格:
当前样式:
您应该将按钮的 bezelStyle
更改为 rounded
,例如:
nomplusbut.bezelStyle = .rounded