重新启动之前已最小化然后关闭的非小型化可可应用程序
我的 Cocoa 应用程序在最小化然后关闭并重新启动后,以某种方式不会重新打开非最小化状态。在其他项目中,这种行为不存在,所以我对可能导致这种行为的原因感到有点困惑。
产生此行为的步骤:
- 启动应用程序
- 最小化它
- 关闭它(通过按“x”或 cmd+q)
- 再次启动应用程序
=>现在应用程序开始最小化,我不想要这样。
我尝试停用 Window .xib 中的“可恢复”选项,但我确实想保留窗口的位置和大小。
有没有什么方便的方法可以实现在非最小化状态下重新启动最小化应用程序而不丢失尺寸?
My Cocoa application somehow does not reopen non-minimized after having been minimized and then closed and restarted. In other projects, this behavior was not existent, so I'm a bit confused about what could cause this behavior.
The steps that produce this behavior:
- Launch the application
- Minimize it
- Close it (either by pressing the 'x' or cmd+q)
- Launch the application again
=> Now the app starts minimized, and I don't want this.
I have tried to deactivate the "Restorable" option in the Window .xib, but I do want to keep the position and size of the window.
Is there any convenient way to achieve relaunching a minimized application in a non-minimized state, without losing the dimensions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须在 XIB 中设置窗口的“自动保存”标识符,例如“MainWindow”或其他应该没问题的东西。这告诉用户默认值在什么键下将窗口的框架信息保存在应用程序的首选项文件中。
正如您所提到的,您仍然需要取消选中“可恢复”以防止保存其他状态信息。
You have to set the window's "Autosave" identifier in the XIB, something like "MainWindow" or whatever should be fine. This tells User Defaults under what key to save the window's frame information in the application's preferences file.
As you mentioned, you still have to uncheck "Restorable" to prevent other state information from being saved.