我如何在可可中创建一个“选择对话框”?(How do I create a “Choose Dialog” in cocoa?)
在Apple人机界面指南中,有一个关于选择对话框的部分,与Open Dialog不同:
默认情况下,对话框的标题是“选择”。例如,如果显示对话框的命令是“选择图片”,则将对话框标题为“选择图片”。如果有帮助,请将“选择”按钮更改为更具体的内容。
但是,我一直无法找到任何有关如何创建一个文档,而不是一个常规的NSOpenPanel 。
In the Apple Human Interface Guidelines, there's a section about Choose Dialogs, which are distinct from Open Dialogs:
By default, the dialog’s title is “Choose.” If, for example, the command that displays the dialog is Choose Picture, title the dialog “Choose Picture.” If it’s helpful, also change the Choose button to something more specific.
However, I've been unable to find any documentation on how to create one, as opposed to a regular NSOpenPanel.
最满意答案
尝试以下操作:
NSOpenPanel *openPanel=[NSOpenPanel openPanel]; [openPanel setTitle: @"Choose File"]; [openPanel setPrompt: @"Choose"]; [openPanel setCanChooseDirectories: YES]; [openPanel setCanChooseFiles: NO]; if ([openPanel runModal] != NSCancelButton) { // Use -[openPanel URL]... }Try the following:
NSOpenPanel *openPanel=[NSOpenPanel openPanel]; [openPanel setTitle: @"Choose File"]; [openPanel setPrompt: @"Choose"]; [openPanel setCanChooseDirectories: YES]; [openPanel setCanChooseFiles: NO]; if ([openPanel runModal] != NSCancelButton) { // Use -[openPanel URL]... }更多推荐
发布评论