gpt4 book ai didi

cocoa - 在 Lion 中显示像 XCode 一样的启动面板

转载 作者:行者123 更新时间:2023-12-03 16:38:37 25 4
gpt4 key购买 nike

我的应用程序在启动时提示用户使用模板选择器,这在 Snow Leopard 上运行良好,但在 Lion 上,可能由于恢复行为,窗口永远不会出现。

我的应用程序基于 NSDocument,我使用 NSDocumentController 在 newDocument:(id)sender 上打开窗口

现在,在 Lion 上,不会调用与“untitiled”相关的应用程序委托(delegate),因此我不知道如何使其正常工作

我认为 XCode 4 是基于 NSDocument 的,它显示了启动面板,它是如何工作的?

另一个智能 XCode 启动面板的行为是仅在没有其他窗口恢复时才显示面板,这又是如何在 Lion 中实现的?

最佳答案

您对新的可恢复状态行为的怀疑是正确的。重新启动/恢复时,应用程序可能永远不会被要求创建新的空文档。发行说明中对此进行了说明:

As part of the restorable windows feature, the application delegate may not be asked to create an Untitled window at launch in some circumstances. This was found to cause crashes in certain apps, so these apps will maintain 10.6 behavior of more often opening Untitled windows. When these apps are recompiled on 10.7, they will acquire the 10.7 behavior. For maximum compatibility, do not depend on being asked to create an Untitled window at launch.

他们没有提到替代方案,并且基于文档的应用程序文档似乎尚未使用可恢复的状态信息进行更新。

对于您的方法,您可以进行更改,以便模板选择器在新的空文档窗口(例如页面或仪器)上显示为工作表。文档的内容在模板表完成后设置。这样,每个新文档都会显示其模板表,但这仅在用户请求新文档时才会发生,而不是依赖于新的应用程序启动(您不再打算这样做)。

关于cocoa - 在 Lion 中显示像 XCode 一样的启动面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7222205/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com