Problem with splash screen rotating on iPad


#1

Hi people, I’m quite new to ionic and cordova, but I’ve been working on this project and I’m having issues with the splash screens on ipads.

It seems that the splash screens is able to rotate beyond it’s initial orientation, which would be fine if it is displayed properly, however, it seems that the image selected is wrong and it gets scaled and distorted.

I’m using the plugin ‘org.apache.cordova.splashscreen’ and my device is an iPad 2 with iOS 8.2.

I’ve run a few tests on xcode and logged the data from the plugin. These are my findings:

  • initial orientation mask is right, in updateImage it looks for the specified image
  • but when it comes to updateBounds when it compares view bound against the image size to get the ratio, that’s where it screws up. the view bounds might have changed by then.

I’ve come up with 2 possible solutions, but can’t seem to find a proper one yet.

  1. prevent auto rotation before webview loads - can’t seem to get it to work in a plugin, not exactly sure how i should use ‘CDVScreenOrientationDelegate’
  2. load both portrait and landscape splash images and switch immediately

I’ve attached the photo here:

Any comments from the pros? thanks!


#2

Not sure if you solved this but give this a try:

Add this plugin:
cordova plugin add https://github.com/cogitor/PhoneGap-OrientationLock.git18

In your config.xml, add:

<'preference name=“SplashScreen” value=“screen” />
<"preference name=“orientation” value=“portrait” />
<'preference name=“SplashScreenDelay” value=“10000” />

In app.js, add:
app.run(function($ionicPlatform, Sms, $window, $state) {

$ionicPlatform.ready(function() {
if(window.navigator && window.navigator.splashscreen) {
window.navigator.splashscreen.hide();
window.plugins.orientationLock.lock();
}