当前位置:首页 > 技术心得 > 正文内容

监听viewcontroller进入后台

xjtudll11年前 (2015-04-24)技术心得7930

首先,要说明的是:

ViewWillDisappear在进入后台的时候 不会 被触发

监听Home键进入后台:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:)
name:UIApplicationWillResignActiveNotification object:nil]; //监听是否触发home键挂起程序.
监听后台转入前台:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:)
name:UIApplicationDidBecomeActiveNotification object:nil]; //监听是否重新进入程序

扫描二维码推送至手机访问。

版权声明:本文由鸟的天空发布,如需转载请注明出处。

本文链接:http://xjtudll.cn/Exp/355/

标签: ios
分享给朋友:

“监听viewcontroller进入后台” 的相关文章

NodeMCU无限打印:wifi_event_monitor_handle_event_cb is called

NodeMCU一直输出: wifi event monitor handle event cb is called wifi event monitor handle event cb is called wifi event monitor handle event cb is ca...

金蝶 老单增加工具栏按钮(Raise Event)

Public Sub AddToolButton(name As String, Caption As String, Description As String, Optional imagefilename As String = '', Optional iOrder As Long = 47...

php gettext无效解决

php gettext无效解决

 代码:$lang = 'en_US'; //linux不支持zh-Hans,所以gettext、php都不支持。使用locale -a可以看到os支持的语言文字国家地区码。putenv('LANGUAGE='&nbs...

ComboBox自绘异常与DrawItem不响应等问题

ComboBox自绘异常与DrawItem不响应等问题

https://blog.csdn.net/wghhdzwzqbx02/article/details/7277937    对于ComboBox而言,虽然与Button相比,自绘都在DrawItem函数中进行,但是实际自绘过程远比Button复杂。原因之一就在于它本身的复杂度:...

android studio 3.0 前进和后退功能

使用android studio 3.0 开发Android程序时,需要用到前进和后退功能(跳到上一个源文件和下一个源文件) 快捷键是alt+Left 和alt+Right。 勾选view-->Toolbar 可以放到工具栏...

Win7 64bit右键添加 显示/隐藏文件+扩展名 及问题解决

目前网上广为流传的 显示/隐藏文件+扩展名有两种方式: 1、小工具 2、修改注册表 第一种方式,找个小工具软件,我找了很多,但都不适合Win7 64bit,XP或Win7 32bit或许适用。关于这个工具的相关介绍及下载,可以参照以下网址: http://www.iplaysof...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。