判断app是在前台还是后台

    if(application.applicationState == UIApplicationStateActive)
    {
        NSLog(@"前台");
    }
    if (application.applicationState == UIApplicationStateBackground) {
        NSLog(@"后台");
    }
    if (application.applicationState == UIApplicationStateInactive) {
        NSLog(@"houtai"); 
    }

你可能感兴趣的:(iOS)