监听是否触发home键挂起程序和是否重新进入程序程序.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:)

name:UIApplicationWillResignActiveNotification object:nil]; //监听是否触发home键挂起程序.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:)

name:UIApplicationDidBecomeActiveNotification object:nil]; //监听是否重新进入程序程序.


- (void)applicationWillResignActive:(NSNotification *)notification

{

printf("按理说是触发home按下\n");

}

- (void)applicationDidBecomeActive:(NSNotification *)notification

{

printf("按理说是重新进来后响应\n");

[NSTimer scheduledTimerWithTimeInterval:10.0f target:self selector:@selector(dismissKeyHUD) userInfo:nil repeats:NO];

}

你可能感兴趣的:(监听是否触发home键挂起程序和是否重新进入程序程序.)