NSApplication orderFrontStandardAboutPanel:使我的“关于”面板稍微不那么标准

发布于 2024-09-02 21:32:38 字数 107 浏览 1 评论 0原文

当 NSApplication 收到 orderFrontStandardAboutPanel 消息时,向标准 Cocoa about 对话框添加额外的任意数据(如果有),我有哪些选项(如果有的话)。

What are my options, if any, of adding additional, arbitrary data to the standard Cocoa about dialog that is displayed by an NSApplication when it receives a orderFrontStandardAboutPanel message.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

芸娘子的小脾气 2024-09-09 21:32:38

如果您将名为 Credits.rtf 的文件添加到 Resources 中,则内容将自动在扩展的标准“关于”面板中使用,您可以在文件中添加所需的任何信息。它仍然会从 info.plist 中提取标准版权、版本信息等。这是我所知道的添加任意信息的最简单方法,否则您几乎将不得不推出自己的“关于”面板。

If you add a file named Credits.rtf to Resources the contents will automatically be used in the expanded standard about panel and you can put whatever info you want in the file. It will still pull the standard copyright, version info, etc from the info.plist. It is the easiest way I know of to add arbitrary info, otherwise you pretty much will have to roll your own about panel.

故乡的云 2024-09-09 21:32:38

进一步扩展上面 Darrell Root 和 theMikeSwan 的答案,Apple 文档 对于 NSApplication.AboutPanelOptionKeycredits 属性来说:-

该键的值是信息中显示的 NSAttributedString
面板的面积。如果未指定,AppKit 将查找文件
命名为“Credits.html”、“Credits.rtf”和“Credits.rtfd”,其中
顺序,在 Bundle 类方法 main 返回的包中。这
使用找到的第一个文件。如果没有找到,则保留信息区域
空白。

Expanding further on the answers from Darrell Root and theMikeSwan above, Apple's documentation for the credits property of NSApplication.AboutPanelOptionKey states:-

The value of this key is an NSAttributedString displayed in the info
area of the panel. If not specified, AppKit then looks for a file
named “Credits.html”, “Credits.rtf”, and “Credits.rtfd”, in that
order, in the bundle returned by the Bundle class method main. The
first file found is used. If none is found, the info area is left
blank.

墨落成白 2024-09-09 21:32:38

扩展MikeSwan的答案,我偶然发现,如果将名为Credits.html的文件添加到Resources文件夹中,它的内容将在扩展标准关于面板中使用。事实上,Credits.html 似乎覆盖了 Credits.rtf。

因此,您可以选择使用 html 还是 rtf 格式,或者将“关于”连接到完全不同的自定义窗口控制器。

Expanding on theMikeSwan's answer, by accident I found that if you add a file named Credits.html to the Resources folder, it's contents get used in the expanded standard about panel. In fact Credits.html appears to override a Credits.rtf.

So your choice whether to use html or rtf format, or wire up "About" to a completely different custom window controller.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文