如何最小化ios应用程序 [英] How to minimize an ios app

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

问题描述


可能重复:

强制应用程序关闭并在后台运行

我正在ios中创建一个无线电应用程序。我的应用程序中有一个最小化按钮。所以我想要做的是当用户按下该按钮时,应用程序应该在后台运行,应用程序图标应该显示在通知区域中,就像普通的 Android 无线电应用程序一样。我想知道是否有可能在 iOS 中,我该怎么做呢。任何人都可以给我看一个例子。

I'm creating an radio application in ios. There is a minimize button in my application. So what I want to do is when user press that button the application should be run in the background and the app icon should be displayed in the notification area like normal Android radio app. I want to know is it possible in iOS and how can I do that. Any one can show me an example.

谢谢

推荐答案

以编程方式将应用程序转到后台的唯一方法是打开另一个应用程序(Safari)调用其URL。但我不认为这就是你的想法(因为你说你有一个收音机应用程序)。

The only way to make ones application goes to background programatically is to open another app (Safari) calling its URL. But I don't think that is what you have in mind (since you are saying you have a radio app).

所以如果你想模仿相同的动作,用户按下主页按钮时会发生这种情况,iOS SDK无法实现。来自iOS人机界面guildelines

So if you want to imitate the same action which happens when user pressing home button, it is not possible with iOS SDK. From iOS human interface guildelines


不以编程方式退出

永远不要以编程方式退出iOS应用程序,因为人们倾向于将
解释为崩溃。但是,如果外部环境阻止
您的应用程序按预期运行,您需要告诉您的
用户有关情况并解释他们可以采取的措施。

Never quit an iOS application programmatically because people tend to interpret this as a crash. However, if external circumstances prevent your application from functioning as intended, you need to tell your users about the situation and explain what they can do about it.

Apple也在文档中说

Apple also says in the documentation


人们,而不是应用程序,应该启动和控制行动。
虽然应用程序可以建议采取行动或警告
危险后果,但应用程序通常会错误地从用户处获取
决策权。最好的应用程序找到正确的
平衡,为人们提供他们所需的功能,同时帮助
他们避免危险的结果。

People, not applications, should initiate and control actions. Although an application can suggest a course of action or warn about dangerous consequences, it’s usually a mistake for the app to take decision-making away from the user. The best apps find the correct balance between giving people the capabilities they need while helping them avoid dangerous outcomes.

所以我认为使用公共API是不可能的。

So I don't think it is possible using public API.

这篇关于如何最小化ios应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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