首页 > 解决方案 > 以编程方式打开显示首选项?

问题描述

如何以编程方式打开显示首选项,如下所示,用于网络首选项

[[ NSTask
      launchedTaskWithLaunchPath: @"/usr/bin/open"
      arguments: [ NSArray
   arrayWithObject: [ @"/System/Library/PreferencePanes/Network.prefPane/" stringByExpandingTildeInPath ]]
  ] waitUntilExit ];

标签: objective-cmacoscocoa

解决方案


您可以使用它找到您想要打开的任何 Pref 窗格

/System/Library/PreferencePanes/

显示偏好

 [[ NSTask
      launchedTaskWithLaunchPath: @"/usr/bin/open"
      arguments: [ NSArray
                  arrayWithObject: [ @"/System/Library/PreferencePanes/Displays.prefPane/" stringByExpandingTildeInPath ]]
      ] waitUntilExit ];

推荐阅读