我正在尝试创建一个代理应用程序来为现有的闭源应用程序提供触摸栏功能。我可以通过 API 与应用程序进行通信,但我的触摸栏在未聚焦时会消失。
在 NSTouchBar
文档中它说:
On supported MacBook Pro models, the Touch Bar, above the keyboard, shows instances of the NSTouchBar class from the front-most app.
但是,我想知道是否有办法强制显示哪个触摸栏。我试图不辞职,这在一定程度上起到了作用,但随后我就失去了对应用程序的关注。
func applicationWillResignActive(_ notification: Notification) {
self.activate(ignoringOtherApps: true)
}
最佳答案
我想你自己找到了答案。触摸栏旨在仅显示应用程序特定的控件。
来自苹果Human Interface Guidelines :
The Touch Bar […] is a Retina display and input device that provides dynamic interface controls for interacting with content on the main screen. These controls offer quick access to system-level and app-specific functionality based on the current context.
关于cocoa - 如何在注意力不集中时使 TouchBar 保持事件状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41053746/