iOS如何在控制器中监听当前程序切掉后

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:)
                                                 name:UIApplicationWillTerminateNotification object:nil]; //监听是否触发home键挂起程序.

实现方法

- (void)applicationWillTerminate:(NSNotification *)notification
{
    NSLog(@"按理说是触发home按下\n");
}

你可能感兴趣的:(iOS如何在控制器中监听当前程序切掉后)