美文网首页
监听是否触发home键挂起程序和是否重新进入程序程序.

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

作者: 呦嚯嚯嚯12138 | 来源:发表于2016-11-23 09:19 被阅读18次

[[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键挂起程序和是否重新进入程序程序.

      本文链接:https://www.haomeiwen.com/subject/ihnmpttx.html