cordova-plugin-launchscreen-storyboard
A cordova plugin for using a launch screen storyboard as the splash screen instead of an image
A common use case for this plugin is to control the default CDVLaunchScreen
storyboard launch screen.
Installation
cordova plugin add cordova-plugin-launchscreen-storyboard
or via github
cordova plugin add https://github.com/toddbluhm/cordova-plugin-launchscreen-storyboard.git
Usage
Add the following code to your config.xml
to get the plugin with default settings:
The following preferences can be configured:
NOTE:
StoryboardName
must match the name of your "Launch Screen File" in Xcode, or a null-pointer exception will follow.
If your StoryboardName
is not CDVLaunchScreen
, you must specify it in your config.xml
.
Once the plugin is setup you must now tell it when to fade out. You can do this by setting up a handler in index.html
for the deviceready
event.
Something like the following should work:
document;
Preferences
-
StoryboardName
- The name of the storyboard that contains your launch screen view controller. This will only instantiate the top level view controller in the storyboard. (Default:CDVLaunchScreen
) -
FadeOut
- Enable/Disable the view fading out when its told tohide()
. This uses an EaseOut function. -
FadeOutDuration
- How long should the fade out last (in seconds).
API
These are the javascript APIs exposed off of the window.LaunchScreen
object.
-
hide( callback )
- Hides the launch screen. Usually called in thedeviceready
event handler. Thecallback
is called after the launch screen is fully hidden.callback
has anerror
param which will benull
or an error object if an error occurred. -
show( callback )
- Shows the launch screen. Should never need to be called in practice. Thecallback
is called after the launch screen is fully visible.callback
has anerror
param which will benull
or an error object if an error occurred.
Supported Platforms
- iOS
Contributors
- Daniel Cousens
Contributing Guide
I welcome all pull requests. Before opening a PR please make sure to run the following script if you have modified any js files:
npm run lint
checks for code errors and formats according to js-standard