After setting up a new Phonegap 2.5.0 project in Xcode, I noticed the IDE was warning of a deprecation in the Phonegap sample app:
‘useSplashScreen’ is deprecated. Deprecated in Cordova 2.5. Add/Remove the SplashScreen plugin instead of setting this property.
Phonegap 2.5.0 includes a change to the way the application splash screen is shown and hidden, and this property is no longer used. Instead, the CDVSplashScreen plugin handles this duty and exposes a couple of additional properties, such as auto hide, show spinner etc. These are declared in the project config.xml file.
It seems as though a reference to this property remains in the AppDelegate.m file, which causes the deprecation warning. The
self.viewController.useSplashScreen = YES; line can be commented out.
The Jumping Splash Screen
After messing around with some of the splash screen options, I noticed that when launching the app using the iOS Emulator, the splash screen appeared to jump downward by about 20px before the app launched. This seemed to be caused by the iPhone status bar (the bar a the top displaying the network carrier and time etc).
Some fixes suggest you reduce the height of the splash screen image by 20px (40px for retina), however Xcode will then complain that the images aren’t the correct size for the target device.
Hiding the status bar whilst the splash screen is displayed
If you wish to hide the status bar whilst the splash screen is displayed, there’s no longer a need to crop 20px from the bottom of the splash screen image.
- In Xcode, simply click on your project (in the project folder pane)
- In the main window select your project target. This should display your app target summary.
- Halfway down, in the Status Bar section, check “Hide During Application Launch”
(this option can also be controller in your app’s info.plist file.
Now when the app is built and launched, there should be no status bar whilst the splash screen is displayed. The 20x jump will no longer occur too! However, I found the status bar was is now hidden throughout the entire app.
Displaying the status bar after the splash screen has been hidden
At this point i’m not sure if this is a Phonegap issue, however the solution is nice and simple.
- In the project “Classes” folder, open MainViewController.m
- Find the
[[UIApplication sharedApplication] setStatusBarHidden:NO];before the method return.
This line will re-show the status bar once the Phonegap web view has loaded.