【问题标题】:How do I prevent the launch image from fading out?如何防止启动图像淡出?
【发布时间】:2018-06-09 19:32:17
【问题描述】:

我创建了一个 html、javascript 游戏,并使用 cordova 和 Xcode 将其部署到我的 iphone,问题是当我启动我的应用程序并完成加载时,启动图像在显示我的游戏之前淡出到白屏.我认为这是一种默认行为。我研究了如何防止它消失,这就是我发现的:iOS 7 launch image (splash screen) fades out

但是答案似乎已经过时了,因为我没有一个名为 AppController 的文件,而且它需要一些我没有学过的 Objective-C 知识。

请帮帮我...我只是想摆脱瞬间褪色到白屏的问题。

-编辑-

我意识到在 iOS 中,启动画面图像被称为启动图像,但我决定安装启动画面插件并再次测试我的应用程序,现在启动画面/启动图像的行为有点不同,而不是淡入白屏,它会立即淡入我的游戏,但我不想要淡入淡出效果,所以我像这样编辑了 config.xml 文件,但它仍然会淡出。

这是我的 config.xml 文件的一部分

<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />

   <splash src="res/screen/ios/Default~iphone.png" width="320" height="480"/>
   <splash src="res/screen/ios/Default@2x~iphone.png" width="640" height="960"/>
   <splash src="res/screen/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
   <splash src="res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
   <splash src="res/screen/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
   <splash src="res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
   <splash src="res/screen/ios/Default-568h@2x~iphone.png" width="640" height="1136"/>
   <splash src="res/screen/ios/Default-667h.png" width="750" height="1334"/>
   <splash src="res/screen/ios/Default-736h.png" width="1242" height="2208"/>
   <splash src="res/screen/ios/Default-Landscape-736h.png" width="2208" height="1242"/>

</platform>
<engine name="ios" spec="^4.4.0" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.0" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-splashscreen" spec="^4.1.0" />


<preference name="FadeSplashScreen" value="false"/>

【问题讨论】:

  • 你在使用闪屏插件吗?如果是这样,请分享您的 config.xml
  • 嗨,我已经更新了我的问题,请查看:)

标签: javascript ios xcode cordova


【解决方案1】:

淡入淡出偏好是指动画。

如果您希望启动画面不会自动消失,您必须使用此首选项:

&lt;preference name="AutoHideSplashScreen" value="false" /&gt;

然后,您将不得不使用此 javascript 代码随时隐藏它:

navigator.splashscreen.hide();

【讨论】:

  • 嗨,我忘了提到我通过 Xcode 而不是终端(我使用 mac)部署了应用程序,因此,在通过 Xcode 部署的过程中,该过程没有进行配置。因此,将 xml 考虑在内,初始屏幕功能(例如持续时间)回退到其默认值,但如果我通过 Xcode 进行部署,则 config.xml 被识别并且我能够看到一些更改,感谢您的帮助: )
猜你喜欢
  • 2014-10-17
  • 2013-08-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多