应用程序确实进入了后台功能 [英] Application did enter background function

查看:64
本文介绍了应用程序确实进入了后台功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我的firstViewController中有一个间隔时间很短的计时器,当应用程序进入后台时,我想终止该计时器,但是我应该如何从该函数所在的Applications AppDelegate文件访问它.我知道这是一个非常愚蠢的问题,但我将不胜感激.谢谢!

Hey I got a pretty low interval timer in my firstViewController which I would like to terminate when the app enters background, but how am I supposed to access it from my Applications AppDelegate file where the function is located. I know this is extremely dumb question, but I would appreciate help. Thanks!

推荐答案

在您的firstViewController中,您将收听

In your firstViewController, you would listen for UIApplicationDidEnterBackgroundNotification.

在firstViewController初始化方法中:

In the firstViewController init method:

- (void)addObserver:(id)notificationObserver selector:(SEL)notificationSelector name:(NSString *)notificationName object:(id)notificationSender

这篇关于应用程序确实进入了后台功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆