【发布时间】:2017-10-08 03:55:26
【问题描述】:
我正在尝试创建一个带有 2 个按钮的 NSAlert。
let a = NSAlert()
a.messageText = "Do you want go to A or B?"
a.alertStyle = .informational
a.addButton(withTitle: "Yes")
a.addButton(withTitle: "No")
a.beginSheetModal(for: self.view.window!, completionHandler: { (modalResponse) -> Void in
if modalResponse == NSAlertFirstButtonReturn { // do stuff}
问题是按钮No 出现在Yes 之前,第二个按钮似乎已被预选。为什么会这样?
我需要按钮按添加顺序显示,并且没有预选按钮。
【问题讨论】:
-
按钮放置在警报右侧附近,然后向左侧移动(对于从左到右阅读的语言)。
-
@ColdLogic 好的......谢谢......