是否可以检测我的应用程序是否正在运行并显示在屏幕上? [英] Is it possible to detect if my app is running and displaying on screen?

查看:165
本文介绍了是否可以检测我的应用程序是否正在运行并显示在屏幕上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以检测我的应用是否正在运行并在屏幕上显示?
我们知道,ios支持多任务。
但是如果我的应用程序在所有应用程序前面运行并与用户交互,我更喜欢获得状态。

Is it possible to detect if my app is running and displaying on screen? As we know, ios is supporting multi-task. But I prefer to get the status if my app is running in front of all app and interact to users.

欢迎任何评论

推荐答案

此流程图将阐明多任务处理在iOS 4.0 +中的工作原理:

This flowchart will clarify how the management of the multitasking works in iOS 4.0+:

(摘自这里

什么您需要做的只是管理发送给您的代理的各种消息所设置的变量,例如 applicationWillResignActive applicationDidEnterBackground 通过这种方式,您可以轻松了解应用程序的状态和行为。

What you need to do is just to manage a variable set by the various messages sent to your delegate, eg applicationWillResignActive or applicationDidEnterBackground, in this way you can easily understand in which state is the application and behave accordingly.

这篇关于是否可以检测我的应用程序是否正在运行并显示在屏幕上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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