iOS PhoneGap / Cordova – Splash screen control

In Cordova from 1.6 version exist “AutoHideSplashScreen” attribute. If you need show splash screen until you get onDeviceReady event - change value to NO.

function onBodyLoad()
{  
 document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady()
{
 navigator.splashscreen.hide();
}

But if you have Cordova version until 1.8 it doesn't work. Use instead navigator object:

 cordova.exec(null, null, "SplashScreen", "hide", []);
 cordova.exec(null, null, "SplashScreen", "show", []);

But for iPad you need add to project two new images:

 Default-Portrait.png
 Default-Landscape.png

No comments:

Post a Comment