我正在试图找出如何使应用程序弹出窗口前面和所有其他窗口。 这可能是一个糟糕的解释,所以基本上我希望应用程序在快捷键被击中时表现得像水银或阿尔弗雷德。
我在NSWindow找不到任何我想要的东西......我错过了什么吗?
I'm trying to figure out how to make an application popup front and above all other windows. That may have been a poor explanation so basically I want the app to act like quicksilver or alfred when a shortcut key is hit.
I couldn't find anything that looked like I wanted in NSWindow... Did I miss something?
最满意答案
更具体地说,类似于:
[newWindow setLevel:NSFloatingWindowLevel]; [newWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];...将工作; 第二行可能是您想要的附加行为,允许窗口显示在每个空间中而不仅仅是隔离到一个空间。
另请注意,就窗口级别而言, NSFloatingWindowLevel之上的任何内容NSFloatingWindowLevel可以工作; 为清晰起见,最好使用命名常量。
Even more specifically, something like:
[newWindow setLevel:NSFloatingWindowLevel]; [newWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];...will work; the second line is probably additional behavior that you would want, allowing the window to be shown in every space and not just isolated to one.
Also note that in terms of window levels, anything above NSFloatingWindowLevel will work; it is better to used a named constant for clarity.
更多推荐
发布评论