iOS PhoneGap – Splash screen control
Unfortunately a splash screen is still needed to hide the white flash that is visible just before the UIWebView loads its content. Previously before PhoneGap 1.0, you had no control over this – sometimes your content just takes an extra time to load and you want to control the duration of the splash screen.
There are two steps to enable this, firstly – in PhoneGap.plist, change the value for “AutoHideSplashScreen” to false (by default it is true for legacy code). This will not hide the splash screen, and it will remain on screen indefinitely.
Next, in your code, you will have to explicitly hide the splash screen.
After the deviceready event has been fired, you can call this function anytime you are ready:
navigator.splashscreen.hide();
If you want to just delay hiding the splash screen for 2 seconds for example, you can do this in your deviceready event handler:
setTimeout(function() {
navigator.splashscreen.hide();
}, 2000);
I did this with javascript and css having a very small size image to cover the screen before the content loads. Down side of that i couldnt use a high res image for the second splash image so i ended having a two separate splash svreens. This really helps. Thanks!
Kerim Incedayi
September 15, 2011 at 9:59 pm
Thank you so much for this! I have been looking and struggling for 2 solid days! Works perfectly!
Gemma
September 20, 2011 at 2:01 pm
Thanks! I have been trying to fix this for a long time!!
Andy
October 13, 2011 at 4:42 am
Thanks for your efforts on this important issue Shazron. But – this is not working for me.
I’m using phonegap-1.1.0 and xcode 4.2
Changing AutoHideSplashScreen” to No (false is not one of the available options) has no effect.
Bummer. Any advice?
Dr. Bob
October 27, 2011 at 9:29 pm
working great phonegap 1.2 thanks for sharing this
emile818
November 30, 2011 at 12:47 am