Phonegap程序中,检测到按下Home键按下代码

1、按Home键的触发事件:

在对应的AppDelegate的方法

- (void)applicationWillResignActive:(UIApplication *)application

如果没有这个函数,可以在applicationDelegate.m文件中,自动添加这个函数。


- (void)applicationWillResignActive:(UIApplication *)application
{
    NSLog(@"applicationWillResignActive");
    /*
     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
     */
}



另外:转网上的一篇文章,也是关于按下Home键的。

http://willonboy.tk/?p=131

你可能感兴趣的:(Phonegap程序中,检测到按下Home键按下代码)