判断锁屏还是点击home键进入后台

 1 - (void)applicationDidEnterBackground:(UIApplication *)application
 2 {
 3     // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
 4     // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
 5     UIApplicationState state = [[UIApplication sharedApplication] applicationState];
 6     
 7     if (state  == UIApplicationStateInactive) {//说明是锁屏
 8         [self.viewController ImageUploadFailed];
 9     }else if(state  == UIApplicationStateBackground){//说明进入后台
10         NSLog(@"background");
11     }
12     
13 }
posted @ 2012-09-14 15:38  ValeTu  阅读(549)  评论(0编辑  收藏  举报