![](/img/trans.png)
[英]macOS - How to have NSSavePanel to add a file extension in the file name?
[英]How to display NSSavePanel in MacOS?
我正在嘗試在Mac OSX上顯示NSSavePanel(或任何“保存文件對話框”)。 我正在使用Swift 4中的XCode版本9.3(9E145)構建COCOA應用程序(或4.2?我不確定)。
我試過一切......
像這樣?
let savePanel = NSSavePanel()
savePanel.begin { (result) in
if result.rawValue == NSApplication.ModalResponse.OK.rawValue {
}
}
這個?
let savePanel = NSSavePanel()
savePanel.canCreateDirectories = true
savePanel.showsTagField = false
savePanel.nameFieldStringValue = "result.csv"
savePanel.level = NSWindow.Level(rawValue: Int(CGWindowLevelForKey(.modalPanelWindow)))
savePanel.begin { (result) in
if result.rawValue == NSApplication.ModalResponse.OK.rawValue {
}
}
許多其他方式......
我錯過了什么? 謝謝!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.