0
我试图用2个按钮创建一个NSAlert。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
之前Appers和第二个按钮似乎preselected.Why会出现这种情况?
我需要这些按钮按照它们的添加顺序出现,并且没有预先选择按钮。通过将第一个 “否” 按钮
按钮被放置出发靠近警报的右侧并朝向左侧(用于从左至右读取的语言)。 – ColdLogic
@ColdLogic好吧....谢谢......... – techno