gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:18:46 26 4
gpt4 key购买 nike

我正在使用 PhoneGapiOS9+ 创建 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 build ios --device

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

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

最佳答案

首先添加启动画面插件

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 文件,不建议这样做会增加应用程序大小,但您可以检查是否可行。

干杯。

关于ios - 如何在 PhoneGap 中为 iOS 设置启动画面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40925159/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com