我如何在可可中创建一个“选择对话框”?(How do I create a “Choose Dialog” in cocoa?)

编程入门 行业动态 更新时间:2024-10-04 09:36:54
我如何在可可中创建一个“选择对话框”?(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]... }

更多推荐

本文发布于:2023-08-07 11:27:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464097.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对话框   创建一个   可可   如何在   Dialog

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!