草庐IT

ios - cordova[phonegap] 设置启动画面在 ios 中无法正常工作

coder 2024-01-19 原文

我已经为我的 phonegap 应用添加了启动画面

我正在 http://build.phonegap.com 在线构建 phonegap 应用程序.

启动画面适用于 android。但在 ios 启动画面会在定义的时间之前隐藏

Config.xml 用于启动画面

    <?xml version="1.0" encoding="UTF-8" ?>
    <widget xmlns   = "http://www.w3.org/ns/widgets"
        xmlns:gap   = "http://phonegap.com/ns/1.0"
        xmlns:android   = "http://schemas.android.com/apk/res/android"
        id          = "com.clerisy.arcade"
        versionCode = "10" 
        version     = "1.0.0" >

    <!-- versionCode is optional and Android only -->

    <name>xxxxxxxxxxxxx</name>

    <description>
        xxxxxxxxxxxxxxxxx
    </description>

    <author href="https://build.phonegap.com" email="support@phonegap.com">
        xxxxxxxxxxxxxxxx
    </author>

    <preference name="permissions" value="none"/>
    <preference name="phonegap-version" value="3.6.3" />
    <preference name="orientation" value="default" />
    <preference name="target-device" value="universal" /> 
    <preference name="fullscreen" value="false" /> 
    <preference name="webviewbounce" value="true" />
    <preference name="prerendered-icon" value="true" />
    <preference name="stay-in-webview" value="false" /> 
    <preference name="ios-statusbarstyle" value="black-opaque" /> 
    <preference name="detect-data-types" value="true" /> 
    <preference name="exit-on-suspend" value="false" /> 
    <preference name="show-splash-screen-spinner" value="true" /> 
    <preference name="auto-hide-splash-screen" value="true" />
    <preference name="disable-cursor" value="false" /> 
    <preference name="android-minSdkVersion" value="7" /> 
    <preference name="android-installLocation" value="auto" /> 
    <preference name="backgroundColor" value="0xff38c0f4"/>
    <preference name="AutoHideSplashScreen" value="false" />   
    <preference name="ShowSplashScreenSpinner" value="false" /> 

    <!-- Plugins -->
    <!-- Core plugins -->

    <gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" />
    <gap:plugin name="org.apache.cordova.network-information" version="0.2.12" />
    <gap:plugin name="nl.x-services.plugins.socialsharing" version="4.3.8" />
    <gap:plugin name="org.apache.cordova.device" version="0.2.12" />
    <gap:plugin name="com.phonegap.plugin.statusbar" version="1.1.0" />
    <gap:plugin name="org.apache.cordova.splashscreen" />

    <!-- Set Icon and splash screen -->

    <icon src="icon.png" platform="android" width="57" height="57" density="mdpi" />
    <gap:splash src="screen.png"/>  
    <gap:config-file platform="ios" parent="CFBundleShortVersionString">
    <string>100</string>
    </gap:config-file>
    <content src="index.html" />
    <access origin="*" />
</widget>

隐藏我正在使用的启动画面

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
   // Hide splash Screen
   setTimeout(function() {
            navigator.splashscreen.hide();
        }, 2000);

问题是:-

它在 android 上运行良好,但在 iphone 上它会在几秒钟后改变启动画面的分辨率。

最佳答案

安装启动画面插件

cordova plugin add org.apache.cordova.splashscreen

对于 iOS,您必须在 document ready 中的超时函数内隐藏启动画面,您可以定义启动画面应隐藏的持续时间。

setTimeout(function() {
                navigator.splashscreen.hide();
            }, 8000);

在 config.xml 中将自动隐藏启动设置为 false

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

有关更多详细信息,请参阅插件文档 https://github.com/apache/cordova-plugin-splashscreen/blob/master/doc/index.md

关于ios - cordova[phonegap] 设置启动画面在 ios 中无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26777044/

有关ios - cordova[phonegap] 设置启动画面在 ios 中无法正常工作的更多相关文章

  1. ruby - 使用 RubyZip 生成 ZIP 文件时设置压缩级别 - 2

    我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看ruby​​zip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d

  2. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  3. ruby-openid:执行发现时未设置@socket - 2

    我在使用omniauth/openid时遇到了一些麻烦。在尝试进行身份验证时,我在日志中发现了这一点:OpenID::FetchingError:Errorfetchinghttps://www.google.com/accounts/o8/.well-known/host-meta?hd=profiles.google.com%2Fmy_username:undefinedmethod`io'fornil:NilClass重要的是undefinedmethodio'fornil:NilClass来自openid/fetchers.rb,在下面的代码片段中:moduleNetclass

  4. ruby-on-rails - 'compass watch' 是如何工作的/它是如何与 rails 一起使用的 - 2

    我在我的项目目录中完成了compasscreate.和compassinitrails。几个问题:我已将我的.sass文件放在public/stylesheets中。这是放置它们的正确位置吗?当我运行compasswatch时,它不会自动编译这些.sass文件。我必须手动指定文件:compasswatchpublic/stylesheets/myfile.sass等。如何让它自动运行?文件ie.css、print.css和screen.css已放在stylesheets/compiled。如何在编译后不让它们重新出现的情况下删除它们?我自己编译的.sass文件编译成compiled/t

  5. ruby-on-rails - 无法使用 Rails 3.2 创建插件? - 2

    我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby​​1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在

  6. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

  7. ruby-on-rails - 如何使用 instance_variable_set 正确设置实例变量? - 2

    我正在查看instance_variable_set的文档并看到给出的示例代码是这样做的:obj.instance_variable_set(:@instnc_var,"valuefortheinstancevariable")然后允许您在类的任何实例方法中以@instnc_var的形式访问该变量。我想知道为什么在@instnc_var之前需要一个冒号:。冒号有什么作用? 最佳答案 我的第一直觉是告诉你不要使用instance_variable_set除非你真的知道你用它做什么。它本质上是一种元编程工具或绕过实例变量可见性的黑客攻击

  8. ruby-on-rails - 无法在centos上安装therubyracer(V8和GCC出错) - 2

    我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e

  9. ruby - 无法让 RSpec 工作—— 'require' : cannot load such file - 2

    我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳

  10. ruby-on-rails - 启动 Rails 服务器时 ImageMagick 的警告 - 2

    最近,当我启动我的Rails服务器时,我收到了一长串警告。虽然它不影响我的应用程序,但我想知道如何解决这些警告。我的估计是imagemagick以某种方式被调用了两次?当我在警告前后检查我的git日志时。我想知道如何解决这个问题。-bcrypt-ruby(3.1.2)-better_errors(1.0.1)+bcrypt(3.1.7)+bcrypt-ruby(3.1.5)-bcrypt(>=3.1.3)+better_errors(1.1.0)bcrypt和imagemagick有关系吗?/Users/rbchris/.rbenv/versions/2.0.0-p247/lib/ru

随机推荐