gpt4 book ai didi

objective-c - 将首选项 Pane 添加到应用程序

转载 作者:行者123 更新时间:2023-12-03 16:39:04 25 4
gpt4 key购买 nike

我有一个位于菜单栏中的应用程序,与这个非常相似
menu app

我正在尝试为其创建一个首选项 Pane ,如 the apple docs 中所述。 .
该指南展示了如何创建系统偏好设置的 prefpane 插件和独立应用程序的偏好窗口。然而,在第二种情况下,它似乎遗漏了一些东西。

因此,我有一个主应用程序类,当用户单击菜单中的“首选项...”时,将调用 -(IBAction) displayPreferences:(id)sender; 操作。
我还有 Controller 扩展 NSPreferencePane 并连接到 Interface Builder 中的 NSWindow 对象(就像文档描述的那样)。

问题是,如何连接它们?即,

-(IBAction) displayPreferences:(id)sender {
// what do we write here to display preferences window?
}

谢谢!

最佳答案

如果您希望在首选项 Pane 中打开“系统偏好设置”,您可以为 .prefPane bundle 创建一个文件 URL,然后将其发送到 -[NSWorkspace openURL:] 。如果您想真正明确启动选项,可以使用 -[NSWorkspace openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:] .

关于objective-c - 将首选项 Pane 添加到应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4879047/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com