iOS 监听 出发 Home键 NSNotificationCenter UIApplicationWillResignActiveNotification
来源:互联网 发布:seo外包公司哪家好 编辑:程序博客网 时间:2024/05/17 01:13
第一步:
创建2个NSNotificationCenter监听
第二步:
实现2个NSNotificationCenter所触发的事件方法
注: 在home键触发后,AppDelegate响应的方法为:
创建2个NSNotificationCenter监听
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:)name:UIApplicationWillResignActiveNotification object:nil]; //监听是否触发home键挂起程序. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:)name:UIApplicationDidBecomeActiveNotification object:nil]; //监听是否重新进入程序程序.
第二步:
实现2个NSNotificationCenter所触发的事件方法
- (void)applicationWillResignActive:(NSNotification *)notification{ printf("按理说是触发home按下\n");}- (void)applicationDidBecomeActive:(NSNotification *)notification{ printf("按理说是重新进来后响应\n");}
注: 在home键触发后,AppDelegate响应的方法为:
- (void)applicationDidEnterBackground:(UIApplication *)application{ /* Use this method to release shared resources, save user data, invalidate timers,
and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. */}
- iOS 监听 出发 Home键 NSNotificationCenter UIApplicationWillResignActiveNotification
- iOS NSNotificationCenter监听移除
- iOS NSNotificationCenter监听移除
- iOS NSNotificationCenter监听移除
- UIApplicationWillResignActiveNotification
- iOS 监听键盘的高度 - NSNotificationCenter
- home键监听
- home键监听
- 监听home键
- home键监听
- home键监听
- android监听home键
- android 监听HOME键
- 监听HOME键
- 监听home键
- Android 监听Home键
- 监听HOME键
- android Home键监听
- js图片左右滚动
- 内存 profile (zz)
- 谈谈RTP传输中的负载类型和时间戳
- Ruby List Files
- JQ-UI控件记录
- iOS 监听 出发 Home键 NSNotificationCenter UIApplicationWillResignActiveNotification
- MySQL垂直和水平切分-转载整理
- JS正则表达式大全
- 限制文本框的输入代码
- Android Framework ContentProvider框架
- 严重: Exception starting filter struts2
- 简单易懂 经典按键检测程序(包含长按功能)
- MySql按日期进行统计(前一天、本周、某一天)
- Gridview自定义分页