如何在PhoneGap中设置iOS启动屏幕

如何在PhoneGap中设置iOS启动屏幕,ios,cordova,splash-screen,phonegap-cli,launchimage,Ios,Cordova,Splash Screen,Phonegap Cli,Launchimage,我正在使用PhoneGap为iOS9+创建iOS应用程序。根据指南,我在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"> <

我正在使用
PhoneGap
iOS9+
创建
iOS
应用程序。根据指南,我在
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>
它在
iOS
平台中复制所有启动图像


但当我启动应用程序时,它会显示默认的
Phonegap
启动屏幕图像。我签入了iOS项目“Images.xcsets”->”
LaunchImage
,它显示了默认的
PhoneGap
图像。它没有显示我在Config.xml文件中提到的splash图像。如何使用
config.xml
iOS
设置启动画面?

首先添加启动画面插件

cordova plugin add cordova-plugin-splashscreen
然后在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" />

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

或者尝试默认飞溅屏幕。

只需将完整大小的启动屏幕图像保留在config.xml所在的位置。它将为所有平台复制splash.png文件。不建议这样做。这将增加应用程序大小,但您可以检查这是否有效


干杯。

您需要更改/替换初始屏幕目录(www/res/screen/ios/)中的图像文件。
默认情况下,它包含phone gap的图像

使用ngCordova插件显示或隐藏启动屏幕$cordovaSplashscreen检查此项检查此项我也检查了链接,我尝试了两种方法,即“传统启动图像”和“启动故事板图像”,如文档中所述,它仍然显示默认的Phonegap启动屏幕。我已经在项目中安装了“cordova plugin splashscreen”插件。此外,我还交叉检查了图像大小,它是正确的预期。仍然显示默认的phonegap启动屏幕图像在config.xml中准确地写下我写的行,然后再试一次。我只为iPad开发应用程序。您能为我提供iPad的详细信息吗?解决方案适合我,但需要先使用命令“phonegap platform remove iOS”删除iOS平台,然后使用命令“phoengap build iOS--device”添加它
<!-- 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" />