如何在当前显示的控制器里判断程序是否被杀死?

2017-04-13  本文已影响98人  优雅地小男子

通过添加通知:

//1、添加进入后台的判断
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(comeHome:) name:@"UIApplicationDidEnterBackgroundNotification" object:nil];

//2、添加程序被杀死的判断
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:@"UIApplicationWillTerminateNotification" object:nil];

上一篇下一篇

猜你喜欢

热点阅读