objective-c - 以编程方式打开显示首选项?
问题描述
如何以编程方式打开显示首选项,如下所示,用于网络首选项
[[ NSTask
launchedTaskWithLaunchPath: @"/usr/bin/open"
arguments: [ NSArray
arrayWithObject: [ @"/System/Library/PreferencePanes/Network.prefPane/" stringByExpandingTildeInPath ]]
] waitUntilExit ];
解决方案
您可以使用它找到您想要打开的任何 Pref 窗格
/System/Library/PreferencePanes/
显示偏好
[[ NSTask
launchedTaskWithLaunchPath: @"/usr/bin/open"
arguments: [ NSArray
arrayWithObject: [ @"/System/Library/PreferencePanes/Displays.prefPane/" stringByExpandingTildeInPath ]]
] waitUntilExit ];
推荐阅读
- python - Python什么也不返回
- python - 规范化来自多列数据框的 JSON 对象
- c++ - 为什么打印这个循环队列会导致无限循环?
- ruby - Windows 上的 Ruby 在 cmd 终端中显示错误的 unicode 字符
- python - 类方法中 self=self 的原因是什么?
- php - 使用错误时未定义的变量即将到来
- swiftui - SwiftUI 在 tvOS 中实现 Master 和 Detail 结构
- reactjs - 如何修复反应蛇游戏中的setState异步错误
- javascript - 我正在尝试根据它们的 id 在 html 中订购 div
- algorithm - 特殊对子直到 N