启动画面后,白屏会暂时出现 [英] White screen appears for a split second after splash screen
问题描述
我已经使用IBM mobileFirst 7.0制作了一个应用程序(我也使用了Ionic),我注意到在启动画面之后大约半秒钟,会出现一个白色屏幕。我在网上搜索了一些人说没有评论
autoHideSplash:false,
< wlInitOptions中的$ pre>
并添加此代码:
var app = angular.module('app.controllers',[]);
//手动隐藏启动画面
app.run(函数($ ionicPlatform){
$ ionicPlatform.ready(function(){
setTimeout(function() {
WL.App.hideSplashScreen();
},100);
});
})
在我的控制器中(我只有1个)可以解决问题。但没有任何反应。 (我也改变了超时但似乎没有任何改变)
我想在没有白屏的情况下在启动屏幕消失后立即看到我的应用程序。我怎么能这样做?
UPDATE&解决方案:
在阅读了Idan的回答之后,我做了一些修改问题的修改。
首先在我的index.html中,在Ionic和所有控制器加载后,我在< head>
的末尾加载了MobileFirst。我改变了,现在在< head>
标签中我首先加载:<! - mobileFirst initialization - >
< script src =js / wlInit.js>< / script>
< script src =js / messages.js>< / script>
然后我加载Ionic和控制器。
我还将控制器中WL.App.hideSplashScreen()的超时时间从100更改为1500.
不再出现白屏:D
解决方案我看到你正在使用WL.App API,但你确定你在正确的地方使用它吗?在调用
函数wlCommonInit
之后,只能在中调用此API。
所以我认为你是在正确的道路上。听起来你确实应该尝试扩展启动画面的持续时间,因为你的应用程序中的东西需要一段时间来加载(因此白色闪烁),所以通过延长启动画面一段时间,让任何它加载,然后删除启动屏幕可能是一种可能的解决方法。
- 确保只在调用此API之后调用此API
wlCommonInit
被调用
- 再增加持续时间。
在此处阅读有关API的更多信息: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.0/advanced-client-side-development/common-ui-controls/#splashscreen
I have made an app with IBM mobileFirst 7.0 (I also use Ionic) and I notice that right after the splash screen and for half a second or so, a white screen appears. I searched the web and some people said that uncommenting
autoHideSplash: false,
in wlInitOptions and adding this code:
var app = angular.module('app.controllers', []); //manually hide splash screen app.run(function($ionicPlatform) { $ionicPlatform.ready(function() { setTimeout(function() { WL.App.hideSplashScreen(); }, 100); }); })
in my controller (I only have 1) would solve the issue. Yet nothing happens. (I also changed the timeout but nothing seems to change)
I want to seee my app right after the splash screen dissappears without the white screen. How can I do that?
UPDATE & SOLUTION:
After reading Idan's answer, I made a few changes that fixed the problem. First of all in my index.html, I was loading MobileFirst at the end of my
<head>
, after Ionic and all controllers had loaded. I changed that and now in the<head>
tag I firstly load:<!-- mobileFirst initialization --> <script src="js/wlInit.js"></script> <script src="js/messages.js"></script>
and then I load Ionic and the controllers.
I also changed the timeout of WL.App.hideSplashScreen() in my controller from 100 to 1500.
No white screen appears any longer :D
解决方案I see you're using the WL.App API, but are you sure you're using it in the right place? This API can be called only after
function wlCommonInit
was called.So I think you're on the right path. It sounds like you should indeed try to extend the duration of the splash screen as something in your app is taking a while to load (hence the white flashing), so by extending the splash screen a little while longer, letting whatever it is to load, and then removing the splash screen could be a possible workaround.
- Make sure this API is called only after
wlCommonInit
was called- Increase the duration some more.
Read more about the API, here: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.0/advanced-client-side-development/common-ui-controls/#splashscreen
这篇关于启动画面后,白屏会暂时出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!