After loading the launch image, I get a white screen before my application loads. I am using phonegap with xcode. I would like my app to load on my lauch image so that it follows the ios developer guidelines and provides a smooth looking launch. I think this white screen is a webview loading for my application. I would like for this webview to be clear. Any ideas on a fix for this problem or a workaround?
I have attempted the following code and it made no difference on my launch. This code is located in my MainViewController.m
-void (webViewDidFinishLoad:(UIWebView*) theWebView
{
theWebView.backgroundColor = [UIColor clearColor];
theWebView.opaque = NO;
}
I have researched this a lot but I haven't found a solution.
You will have to overlay a ModalViewController that is faking the "Default.png" image after launch, overlay the view controller on top of the UIWebView, and show a UIActivityIndicator, so the user knows you are loading your app. Once the webpage is done, you can dismiss your view controller.
Hope this helps.
I had a similar problem. I did not fix it in code, rather I fixed it in the UI Editor. The window itself that contains the uiwebview also has a background color in the properties. This can be set to the color of your choice to eliminate the flash of white. (I set mine to black.)
I had faced the same problem too, try these 3 steps which I did to solve the issue:
set
AutoHideSplashScreen
toNO
in your phonegap/cordova plist fileAdd this line to your viewDidLoad method of CDVMainViewController.m
Then add this code to
onDeviceReady()
methodI was facing the same issue, and after doing some research I found that this is being caused because the application requires some time to load all the required .css and .js files.
To overcome the issue we can use the splash screen and also delay its time, so that till all the required files are loaded, the end-user wont see a gibberish white screen instead our customized splash screen would be visible.
I solved it by referring the first and second part of the answer given by "ian". These are the steps that I followed.
Step 1: install the Cordova Splashscreen plugin.
cordova plugin add org.apache.cordova.splashscreen
Step 2: Set the Auto Hide Splash Screen Preference from config.xml file to false.
Step 3: Increase the splash screen delay time
Hope this helps some one :)
Have you thought about manually hiding the splash screen rather so that your page is ready before it disappears ?
And set
AutoHideSplashScreen
to NO in your phonegap/cordova plist fileAs of Cordova/Phonegap 3+, you need to set the preference in config.xml:
You will also need the plugin:
Then,