gpt4 book ai didi

ios - 加载应用程序时 Cordova iOS 启动图像更改

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:18:03 27 4
gpt4 key购买 nike

我已经在 Resources/splash 文件夹中使用正常的命名方案(Default~ipad.png、Default-Portrait@2x~ipad.png 等)设置了我的启动图像/splashscreen。我没有设置任何 UILaunchImage* plist 条目。

当我在 iPad2 上启动我的 Cordova 应用程序时,它会立即加载我的启动图像之一。几秒钟后(当 org.apache.cordova.splashscreen 插件开始运行时,从我在日志中看到的),启动图像将发生变化,通常是不同分辨率的东西,因此整个图像会发生变化。在那之后,图像保持原样,直到我调用 navigator.splashscreen.hide()。这也发生在 iPhone4 上。

再次,启动画面在应用程序打开时立即显示,几秒钟后移动,页面完成加载(根据控制台)大约 5 秒,然后 navigator.splashscreen.hide() 在我的 ready( ) 事件。

在我看来,Xcode 可能默认选择我的一张图片作为启动图片,然后 cordova s​​plashscreen 插件在加载其他插件时选择另一张图片。我最初确实得到了一个黑色的闪光,并且无法找到“Default.png”的控制台错误,所以我在启动图像中添加了一个“Default~ipad.png”。我原以为它会为 ipad 使用纵向或横向图像,但插件似乎只在 CDV_IsIPad() 和 isOrientationLocked 时才这样做。

我什至尝试将 Resources/splash 中的所有图像恢复为默认的 Cordova 启动图像。当我这样做时,Cordova 启动图像会在应用程序加载时立即显示,几秒钟后,当 Cordova 启动画面插件加载时,启动图像会更改为我的启动图像之一,然后在 navigator.splashscreen.hide() 上消失。发生这种情况时,我无法在任何地方找到我从项目中删除的启动图像的任何引用;不在 Resources/splash 或 plist 中。很奇怪。

为什么闪屏会被 cordova 闪屏插件改变,或者我应该如何解决这个问题?有什么想法吗?

最佳答案

我最终查看了 Cordova Splashscreen 插件的拉取请求,只是想看看是否有人解决了这个问题。 Looks like they did!

src/ios/CDVSplashScreen.m 中:

- } else if (CDV_IsIPad() && isOrientationLocked) {
- switch (orientation) {
- case UIInterfaceOrientationLandscapeLeft:
- case UIInterfaceOrientationLandscapeRight:
- imageName = [imageName stringByAppendingString:@"-Landscape"];
- break;
-
- case UIInterfaceOrientationPortrait:
- case UIInterfaceOrientationPortraitUpsideDown:
- default:
- imageName = [imageName stringByAppendingString:@"-Portrait"];
- break;

应该是

+    } else if (CDV_IsIPad()) {
+ if (isOrientationLocked) {
+ imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"-Portrait")];
+ } else {
+ switch (orientation) {
+ case UIInterfaceOrientationLandscapeLeft:
+ case UIInterfaceOrientationLandscapeRight:
+ imageName = [imageName stringByAppendingString:@"-Landscape"];
+ break;
+
+ case UIInterfaceOrientationPortrait:
+ case UIInterfaceOrientationPortraitUpsideDown:
+ default:
+ imageName = [imageName stringByAppendingString:@"-Portrait"];
+ break;
+ }

关于ios - 加载应用程序时 Cordova iOS 启动图像更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24263212/

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