I am using PhoneGap
for creating iOS
application for iOS9+
. As per guide line I have added following code in Config.xml
to set the splash screen.
// 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>
Then I used following command in 'Terminal' to generate iOS platform
phonegap build ios --device
It copies all the splash images in iOS
platform.
But it show default Phonegap
splash screens image when I launch the app. I checked in iOS project 'Images.xcassets'-> 'LaunchImage
, it is showing default PhoneGap
images. It is not showing splash Image which I mentioned in Config.xml file. How do I set the splash images using config.xml
for iOS
?
答案 0 :(得分:5)
首先添加启动画面插件
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文件,不建议这会增加应用程序大小,但您可以检查是否有效。
干杯。
答案 1 :(得分:0)
您需要在启动画面目录(www / res / screen / ios /)中更改/替换图像文件。 默认情况下,它包含手机间隙图像