如何在PhoneGap中为iOS设置启动画面

Roh*_*ale 3 splash-screen ios cordova launchimage phonegap-cli

我正在PhoneGap用于创建iOS应用程序iOS9+.根据指南,我添加了以下代码Config.xml来设置启动画面.

// set the cordova plugin 
 <plugin name="cordova-plugin-splashscreen" source="npm" spec="&gt;1.0.0" />

 // set splash screen for iPad only
 <platform name="ios">
    <gap:splash gap:platform="ios" height="2048" src="res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" />
    <gap:splash gap:platform="ios" height="2048" src="res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" />
    <gap:splash gap:platform="ios" height="768" src="res/screen/ios/Default-Landscape~ipad.png" width="1024" />
    <gap:splash gap:platform="ios" height="1536" src="res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" />
</platform>
Run Code Online (Sandbox Code Playgroud)

然后我在'终端'中使用了以下命令来生成iOS平台

phonegap build ios --device
Run Code Online (Sandbox Code Playgroud)

它复制iOS平台中的所有启动图像.

但是Phonegap当我启动应用程序时,它会显示默认的启动画面图像.我检查了iOS项目'Images.xcassets' - >' LaunchImage,它显示的是默认PhoneGap图像.它没有显示我在Config.xml文件中提到的splash image.如何使用config.xmlfor 设置启动图像iOS

Anu*_*j.T 5

首先添加Splash屏幕插件

cordova plugin add cordova-plugin-splashscreen
Run Code Online (Sandbox Code Playgroud)

然后在config.xml中添加这些行.

<!-- iOS splash screen -->
<!-- iPad -->
<splash src="www/res/screen/ios/Default-Portrait.png" platform="ios" width="768" height="1024" />
<splash src="www/res/screen/ios/Default-Landscape.png" platform="ios" width="1024" height="768" />
<!-- Retina iPad -->
<splash src="www/res/screen/ios/Default-Portrait@2x.png" platform="ios" width="1536" height="2048" />
<splash src="www/res/screen/ios/Default-Landscape@2x.png" platform="ios" width="2048" height="1536" />

<!-- Default splash screen -->
<splash src="splash.png" />
Run Code Online (Sandbox Code Playgroud)

确保图像宽度高度应与config.xml中定义的相同.

或尝试默认的splashscreen.

只需保留config.xml所在的全尺寸启动画面图像,它将复制所有平台的splash.png文件,不建议这会增加应用程序大小,但您可以检查是否有效.

干杯.