码迷,mamicode.com
首页 > 其他好文 > 详细

怎么在某个控制器中判断程序是否在前台或后台

时间:2016-04-20 13:37:50      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(appHasGoneInForeground:)
                                      name:UIApplicationWillEnterForegroundNotification
                                           object:nil];  
//别忘了删除监听
[[NSNotificationCenter defaultCenter] removeObserver:self];   


UIApplicationDidEnterBackgroundNotification  //进入后台
UIApplicationWillEnterForegroundNotification //回到程序

怎么在某个控制器中判断程序是否在前台或后台

标签:

原文地址:http://www.cnblogs.com/pangbin/p/5411959.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!