zoukankan      html  css  js  c++  java
  • iOS判断程序在前台还是后台

    [UIApplication sharedApplication].applicationState will return current state, check it possible values and don’t create unnecessary flags when you can use system features.

    Values you may want to consider:

    • UIApplicationStateActive(前台)
    • UIApplicationStateInactive(收到通知)
    • UIApplicationStateBackground(后台)

    e.g.

    +(BOOL) runningInBackground
    {
        UIApplicationState state = [UIApplication sharedApplication].applicationState;
        BOOL result = (state == UIApplicationStateBackground);
    
        return result;
    }
    
    +(BOOL) runningInForeground
    {
        UIApplicationState state = [UIApplication sharedApplication].applicationState;
        BOOL result = (state == UIApplicationStateActive);
    
        return result;
    }
  • 相关阅读:
    maven将依赖依赖打包到jar中
    Python模块之信号(signal)
    mog使用指南
    Docker 入门
    注册码
    区块链Readme.md
    彻底卸载 postgreSQL .etc
    Django
    111
    pip 安装 lxml等 出错 解决
  • 原文地址:https://www.cnblogs.com/sytfyf/p/6108717.html
Copyright © 2011-2022 走看看