我如何使窗口(osx)始终悬停在屏幕顶部

发布于 2024-09-10 13:31:31 字数 58 浏览 1 评论 0原文

我试图制作一个只有一个窗口的 osx 应用程序,并且它始终位于屏幕顶部。 有人知道如何实现它吗?谢谢。

i trying to make a osx application that just have one window and it will always on the top of screen.
anyone knows how to achieve it? thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

再见回来 2024-09-17 13:31:31

您可以将窗口的 windowLevel (通过 -setLevel:)更改为 NSFloatingWindowLevel。

[window setLevel:NSFloatingWindowLevel]; 

文档位于:Window_Levels

You can change the window's windowLevel (via -setLevel:) to NSFloatingWindowLevel.

[window setLevel:NSFloatingWindowLevel]; 

Documentation is here: Window_Levels

温柔戏命师 2024-09-17 13:31:31

“在顶部”是指您不希望窗口被遮挡,即使有不同的应用程序处于活动状态?在这种情况下,一种方法是从 Interface Builder 中的 NSPanel 模板开始,选中“实用程序”选项,然后取消选中“停用时隐藏”。

By "on the top", do you mean you do not want your window to be obscured, even if a different app is active? In that case, one way is to start with the NSPanel template in Interface Builder, check the "Utility" option, and uncheck "Hide on Deactivate".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文