我正在使用PhoneGap
为iOS9+
创建iOS
应用程序。根据指南行,我在Config.xml
中添加了以下代码以设置Splash屏幕。
// set the cordova plugin
<plugin name="cordova-plugin-splashscreen" source="npm" spec=">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 build ios --device
它复制了iOS
平台中的所有飞溅图像。
但是,当我启动应用程序时,它显示默认的Phonegap
启动屏幕图像。我在iOS项目的" Images.xcassets" ->'LaunchImage
中检查了它,它显示默认的PhoneGap
图像。它没有显示我在config.xml文件中提到的飞溅图像。如何使用iOS
的config.xml
设置飞溅图像?
首先添加 Splash屏幕插件
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" />
确保图像 width 和高度应与Config.xml中定义的相同。
或尝试默认的splashscreen。
只需将全尺寸启动屏幕映像放置在您的config.xml所在的位置,它将复制splash.png文件,不建议这样做会增加应用程序的大小,但是您可以检查是否有效。
欢呼。
您需要在splash屏幕目录(www/res/screen/ios/)中更改/替换图像文件。默认情况下,它包含电话差距的图像