Phonegap 3飞溅后白色闪烁 [英] Phonegap 3 white flash after splash

查看:199
本文介绍了Phonegap 3飞溅后白色闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这已经被问过(回答了)几次( Phonegap显示白屏后的启动画面 - IOS 如何杀死白色闪烁的闪屏开始Phonegap iOS应用程序?),但这些解决方案似乎没有为我工作。也许是因为我使用Phonegap版本3?

I know this has been asked (and answered) several times (Phonegap showing white screen after the splash screen - IOS, Phonegap 2.0 - on app launch a white screen flashes prior to my app loading, how to to kill the white flickering splashscreen at the start of phonegap iOS app ?) but none of these solutions seem to be working for me. Maybe because I'm using Phonegap version 3?

我只加载Phonegap和jQuery 2.0.0(其他解决方案处理jQuery-mobile,我不使用),我只指定iOS部署。我有一个启动图像加载,然后应用程序显示一个白色屏幕(持续时间不同 - 我猜它正在加载应用程序可能吗?)然后我的index.html加载我的第一个屏幕。这是我现在的头:

I'm only loading Phonegap and jQuery 2.0.0 (other solutions deal with jQuery-mobile which I'm not using) and I'm only targeting iOS for deployment. I've got a splash image loading, then the app displays a white screen (duration varies - I'm guessing it's loading up the app perhaps?) then my index.html loads up my first screen. Here's my current head:

<head>
    <meta charset="utf-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="user-scalable=no, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

    <link type="text/css" rel="stylesheet" href="css/main.css" />

    <title>My App</title>

    <script type="text/javascript" src="phonegap.js"></script>
    <script src="js/lib/jquery-2.0.0.min.js"></script>
    <script src="js/main.js"></script>      
</head>

我试过将它添加到我的config.xml中(与index.html相同的文件夹级别):

I tried adding this to my config.xml (at the same folder level as index.html):

<preference name="backgroundColor" value="0x000000" />

但我仍然得到白屏闪烁。我也尝试手动隐藏/显示飞溅:

but I still get the white screen flash. I also tried manually hiding/showing the splash with:

function onDeviceReady() {
    navigator.splashscreen.show();
}

但似乎没有任何效果。任何人有任何建议?

but that didn't seem to have any effect at all. Anybody have any suggestions?

推荐答案

我终于能够消除闪光灯,但我不得不使用Cordova来做。以下是我采取的步骤:

I was finally able to eliminate the splash flash, but I had to use Cordova to do it. Here are the steps I took:

在航站楼:

cordova create ~/path/to/project "com.appname.app" "appName"
cd ~/path/to/project
cordova platform add ios
cordova build
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git
cordova build

使用Finder导航到〜/ path / to / project / platforms / ios / ,然后双击 projectname.xcodeproj 在Xcode中打开项目。

Use Finder to navigate to ~/path/to/project/platforms/ios/ and double-click projectname.xcodeproj to open the project in Xcode.

接下来,我进入并编辑了图像。你可以做任何数量的方式。这是我做的:在Xcode,导航到资源/ splash / ,右键单击图像更改,选择在Finder中显示并使用任何工具,你想要更改的图像。

Next, I went in and edited the images. You could do it any number of ways. Here's what I did: In Xcode, navigate to Resources/splash/, right-click the image to change, select Show in Finder and use whatever tools you want to change the images.

完成后,返回Xcode并打开根级别 config.xml 是两个 config.xml 文件,但你想要的文件夹结构中最远的一个)。将 AutoHideSplashScreen 属性更新为

Once finished, head back to Xcode and open the root-level config.xml (Still not sure why there are two config.xml files, but you want the one furthest out in the folder structure). Update the AutoHideSplashScreen property to

< preference name =AutoHideSplashScreenvalue = false/>

从Xcode主菜单中选择 Product> Clean ,然后产品>建立

From the Xcode main menu, select Product > Clean and then Product > Build.

反复为我工作。我可以使用 navigator.splashscreen.show() navigator.splashscreen.hide()我的应用程序(似乎没有通过所有这些步骤响应)。

Worked for me repeatedly. I was able to then use the navigator.splashscreen.show() and navigator.splashscreen.hide() methods from my app (which didn't seem to be responding without going through all these steps).

希望这有助于!

这篇关于Phonegap 3飞溅后白色闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆