防止“恢复”为我的Cocoa应用程序? [英] Prevent "Resume" for my Cocoa application?

查看:201
本文介绍了防止“恢复”为我的Cocoa应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢狮子会的新简历功能。重新启动后窗口大小和位置正是你如何离开它。但在开发过程中有点恼人。
如果我在Interface Builder中调整一个窗口并重新启动我的应用程序,它没有新的大小,但是旧的大小。

I love the new "Resume" feature in Lion. After a restart window size and position is exactly how you left it. But during development this is a bit annoying. If I resize a window in the Interface Builder and restart my application it doesn't have the new size but the old size.

设置AUTOSAVE属性来获得这种行为,但使用恢复它会自动发生。我可以为我的应用程式停用简历吗?

In the past you had to set the AUTOSAVE property to get this kind of behavior but with Resume it all happens automatically. Can I disable resume for my application somehow?

推荐答案

是的。作为Lion AppKit发行说明中记录的,您可以为应用程序设置 ApplePersistenceIgnoreState 用户默认值。 (文档意味着值不重要;它只需要设置为某些东西。)

Yes. As documented in the Lion AppKit release notes, you can set the ApplePersistenceIgnoreState user default for your application. (The docs imply that the value isn't significant; it just needs to be set to something.)

一个简单的方法来做这个调试运行,而保留当你正常使用你的应用程序的状态恢复功能,是在Xcode中设置它。在你的方案的Run操作中,为 -ApplePersistenceIgnoreState 设置一个命令行参数,然后立即设置另一个具有值的命令行参数(例如 YES )。这使得AppKit的特性从命令行读取用户默认值。

An easy way to do this for debug runs only, while preserving the state restoration feature when you use your app normally, is to set it in Xcode. In your scheme's Run action, set a command-line argument for -ApplePersistenceIgnoreState, and, immediately after it, another one with the value (e.g., YES). This makes use of AppKit's feature of reading user defaults from the command-line.

这篇关于防止“恢复”为我的Cocoa应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆