如何在 iPhone4 sdk 中退出(退出)应用程序 [英] how to quit (exit) an app in iPhone4 sdk

查看:13
本文介绍了如何在 iPhone4 sdk 中退出(退出)应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何退出 iPhone4 应用程序?当我使用 exit(0) 时,应用程序进入后台.我想退出应用而不是将其发送到后台.

How can I quit iPhone4 app? When I use exit(0) the app goes in the background. I want to quit the app instead of sending it to the background.

推荐答案

iPhone 应用不应该有退出按钮.用户按主按钮退出.

iPhone apps shouldn't have a quit button. The user quits by pressing the main button.

来自 Apple 的文档:(http://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/MobileHIG.pdf)

From Apple's docs: (http://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/MobileHIG.pdf)

人们通过打开另一个应用程序退出 iPhone 应用程序.特别要注意的是,人们不会点击应用程序关闭按钮或从菜单中选择退出.在 iOS 4.0 及更高版本以及某些设备上,退出应用程序会在后台进入暂停状态.所有 iPhone 应用程序都应该:

People quit an iPhone application by opening a different application. In particular, note that people don’t tap an application close button or choose Quit from a menu. In iOS 4.0 and later, and on certain devices, the quitting application moves to a suspended state in the background. All iPhone applications should:

  • 随时准备退出.因此,应尽快并尽可能多地保存用户数据.
  • 在停止时尽可能详细地保存当前状态.例如,如果您的应用程序显示滚动数据,保存当前滚动位置.

iPhone 应用程序不应该以编程方式退出,因为这样做对用户来说就像是崩溃.但是,有时外部环境可能会阻止您的应用程序按预期运行.处理此问题的最佳方法是显示一个有吸引力的屏幕来描述问题并建议用户如何纠正它.这从两个方面帮助用户:

iPhone applications should never quit programmatically because doing so looks like a crash to the user. There may be times, however, when external circumstances prevent your application from functioning as intended. The best way to handle this is to display an attractive screen that describes the problem and suggests how users can correct it. This helps users in two ways:

  • 它提供的反馈让用户确信您的应用程序没有任何问题
  • 它让用户能够控制自己,让他们决定是否要采取纠正措施并继续使用您的应用程序或按主页按钮并打开其他应用程序

这篇关于如何在 iPhone4 sdk 中退出(退出)应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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