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

2016-11-23  本文已影响18人  呦嚯嚯嚯12138

[[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];

}

上一篇 下一篇

猜你喜欢

热点阅读