Show splash screen when application enters background

I am writing an application using phonegap for iOS. I am trying to show a splash screen when the application goes to the background.

(void)applicationWillResignActive:(UIApplication *)application [...]

Q applicationWillResignActive:I call a JavaScript function and use the cordova method cordova.exec(null,null, "SplashScreen, "show", [])to show a splash screen. But it does not seem to work.

When I resume the application, the application first displays the previous state, and then switches to the splash screen, but I want to show the splash screen when the application resumes. How can i do this?

+2
source share
2 answers

Got this job:

- (void) applicationWillResignActive:(UIApplication *)application {
  //Call to JS to change to splash
 [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.02
}

Allow current runloop to run for a short time

For more information about the answer, please check the link below:

, iOS ?

+3

, , . / -applicationWillResignActive: , , , -applicationDidBecomeActive:

0

All Articles