iPhone 手动保存/加载数据,无需自动加载

发布于 2024-09-12 05:22:21 字数 203 浏览 2 评论 0原文

我正在开发一款使用保存/加载功能的游戏。我正在使用 Plist 来存储数据。

我的方法编码正确...我想?

但问题是,当按下主页按钮并重新启动应用程序时,保存的数据会自动出现。

我更喜欢的是通过屏幕上的“加载”按钮手动加载数据。

我知道加载按钮可以正常工作,但我仍然需要在程序完全关闭(或重新加载?)之前清除数据。请帮忙!谢谢!

I am working on a game that makes use of a save/load feature. I am using a Plist for the data.

I have the methods coded correctly... I think?

The issue, however, is that when the home button is pressed, and the App re-launched, the saved data automatically appears.

What I'd prefer is for the data to be manually loaded via a "LOAD" button on the screen.

I know the load button works correctly, but I still need the data to be cleared before the program completely closes (or reloads?). Please help! Thanks!

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

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

发布评论

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

评论(1

時窥 2024-09-19 05:22:21

如果您的应用程序已经编码为通过“加载”按钮加载数据,那么您应该在用户点击主页按钮时终止该应用程序,而不是让操作系统像当前一样将您的应用程序挂起到后台。

为此,您应该将键 UIApplicationExitsOnSuspend 放入您的 info.plist 文件中。

更多信息请参见:http://developer.apple.com/iphone/library/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW23

If you have the app already coded to load the data for you via a "Load" button, then you should just kill the app when the user hits the home button instead of letting the OS suspend your app into the background like it's currently doing.

To do this, you should place the key UIApplicationExitsOnSuspend in your info.plist file.

More information here: http://developer.apple.com/iphone/library/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW23

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