在启动时设置 NSWindow 位置/大小并且 Lion 全屏恢复 = 布局错误

发布于 2024-12-01 18:33:21 字数 587 浏览 0 评论 0原文

我创建了一个应用程序,它最初在应用程序委托的 applicationWillFinishLaunching:applicationDidFinishLaunching 中存储和恢复窗口大小和位置。

后来我用调用 [NSWindow setFrameUsingName:] 等来替换它,以存储和加载窗口位置和大小。

存储和加载都工作得很好(使用自定义代码和 setFrameUsingName

但现在的问题是:当我在应用程序上启用全屏模式并使用选项“恢复窗口”注销时>”。它将在单独的窗口中启动应用程序以变为全屏,但随后再次调用我的代码以设置窗口 size: 实际上在大全屏屏幕中显示一个小窗口。

看来生命周期几乎以 windowDidEnterFullScreen: 调用结束。 applicationWillFinishLaunching: 在窗口全屏显示之前调用,并且 NSWindow 的 styleMask 尚未显示全屏。

有人能帮助我吗?

I've created an application which initially stores and restores window size and location in the app delegate's applicationWillFinishLaunching: or applicationDidFinishLaunching.

Later I have replaces it with calling [NSWindow setFrameUsingName:] and such to store and load window location and size.

Both storing and loading works just fine (with custom code and with setFrameUsingName)

But now the problem: when I have enabled Fullscreen mode on the application and logout with the option "restore windows". It will launch the application in the separate window to become fullscreen but then my code is called again to set the window size: in effect displaying a small window in the big fullscreen screen.

It seems the lifecycle almost ends with the windowDidEnterFullScreen: call.
The applicationWillFinishLaunching: is called way before the window is put in full screen and the NSWindow's styleMask doesn't show fullscreen there yet.

Anyone able to help me?

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

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

发布评论

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

评论(2

傲娇萝莉攻 2024-12-08 18:33:21

该问题是由应用程序启动期间的淡入动画引起的。
确保您不在应用程序委托中的 applicationWillFinishLaunching 中的窗口上启动动画。

The problems where caused by an fade-in animation during application launch.
Make sure you don't start animation on the window in applicationWillFinishLaunching in the app delegate.

再浓的妆也掩不了殇 2024-12-08 18:33:21

尝试在 windowWillEnterFullScreen 中设置一个标志,让您的窗口知道不要设置其大小。

Try setting a flag in windowWillEnterFullScreen to let your window know not to set its size.

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