Cocoa - 覆盖 Lion 窗口大小持久性
我有一个 Cocoa 应用程序,它取决于主窗口打开时的特定大小。然而,在运行时,我下拉了一个 WebView 并有效地更改了窗口的框架大小。下次我打开一个新窗口时,它的大小是我用扩展后的框架大小留下的。
我尝试在 -windowWillClose
和 applicationWillTerminate
中重置帧大小,但前者不执行任何操作,后者在关闭时使应用程序崩溃。
I have a Cocoa App that depends on the main window being a certain size when it opens. While running, however, I drop down a WebView and effectively change the frame size of the window. Next time I open a new window, its the size I left it with the expanded frame size.
I tried resetting the frame size in -windowWillClose
and in applicationWillTerminate
, but the former does nothing and the latter crashes the application upon closing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在界面生成器中取消选中窗口的可恢复(或类似的选项[我现在不在我的Mac])。然后确保程序启动时显示该窗口。
Uncheck Restorable (or something like it [I'm not at my Mac right now]) for the window in interface builder. Then make sure the window is shown when your program starts.