iOS 运行程序和进入后台通知
来源:互联网 发布:js按钮点击一次后失效 编辑:程序博客网 时间:2024/06/04 18:03
1.创建俩个NSNotificationCenter的 通知
a).
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:)
name:UIApplicationWillResignActiveNotification object:nil]; //监听是否触发home键挂起程序,(把程序放在后台执行其他操作)
b).
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:)
name:UIApplicationDidBecomeActiveNotification object:nil]; //监听是否重新进入程序程序.(回到程序)
2.实现俩个NSNotificationCenter触发的函数
(void)applicationWillResignActive:(NSNotification *)notification
{
nslog(“触发home按下”);
}(void)applicationDidBecomeActive:(NSNotification *)notification
{
nslog(“重新进来后响应”);
}
在home键触发后,程序进入后台,app delegate响应的函数为:
(void)applicationDidEnterBackground:(UIApplication *)application
{}
0 0
- iOS 运行程序和进入后台通知
- iOS程序进入后台后仍运行定时器NSTimer
- iOS程序进入后台后仍运行定时器NSTimer
- iOS程序进入后台后仍运行定时器NSTimer
- iOS程序进入后台后仍运行定时器NSTimer
- iOS程序进入后台后仍运行定时器NSTimer
- iOS程序进入后台后仍运行定时器NSTimer
- iOS程序进入后台后仍运行定时器NSTimer
- iOS程序进入后台后仍运行定时器NSTimer
- iOS程序进入后台后仍运行定时器NSTimer
- iOS程序进入后台后仍运行定时器
- iOS程序进入后台后仍运行定时器NSTimer
- iOS程序进入后台后仍运行定时器NSTimer
- 程序进入后台运行NSTimer
- iOS进入后台长时间运行后台任务
- 添加程序进入后台,进入前台的通知
- ios后台运行程序
- ios后台运行程序
- 爬楼梯的问题Climbing Stairs
- 浅谈版本控制工具git的使用(xcode 终端控制)
- android:descendantFocusability用法简析
- 服务操作工具类
- android 混淆
- iOS 运行程序和进入后台通知
- android自定义loding view(中)
- loadrunner 压测java user遇到的问题
- 设计模式之Facade模式(外观模式)
- markdown语法备忘录
- java读取properties文件方法和对比
- 在android studio下怎么引入android framework来使用隐藏的api
- 短信备份
- 二手房的税费