From cd61952efc68365138115cb1d5fbefa0695198d1 Mon Sep 17 00:00:00 2001 From: Michael Hoisie Date: Tue, 10 Jun 2014 22:40:11 -0700 Subject: [PATCH] CB-7041 ios: Fix image filename logic when setting the iPad splash screen When running Cordova apps without orientation lock on iPads, the Splash Screen plugin didn't work properly. It would skip the iPad- specific splash screen logic, and just select the image named @"Default.png" (without adding the orientation suffix), and print the following messages in the console: WARNING: The splashscreen image named Default was not found Now, for iPads, the splash screen image is set by first looking at the position of the orientation lock, and if that is not set, it uses the calculated view orientation. close #19 --- src/ios/CDVSplashScreen.m | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m index fdfc4c4..7ce828d 100644 --- a/src/ios/CDVSplashScreen.m +++ b/src/ios/CDVSplashScreen.m @@ -138,18 +138,22 @@ if (CDV_IsIPhone5()) { imageName = [imageName stringByAppendingString:@"-568h"]; - } else if (CDV_IsIPad() && isOrientationLocked) { - switch (orientation) { - case UIInterfaceOrientationLandscapeLeft: - case UIInterfaceOrientationLandscapeRight: - imageName = [imageName stringByAppendingString:@"-Landscape"]; - break; + } else if (CDV_IsIPad()) { + if (isOrientationLocked) { + imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"-Portrait")]; + } else { + switch (orientation) { + case UIInterfaceOrientationLandscapeLeft: + case UIInterfaceOrientationLandscapeRight: + imageName = [imageName stringByAppendingString:@"-Landscape"]; + break; - case UIInterfaceOrientationPortrait: - case UIInterfaceOrientationPortraitUpsideDown: - default: - imageName = [imageName stringByAppendingString:@"-Portrait"]; - break; + case UIInterfaceOrientationPortrait: + case UIInterfaceOrientationPortraitUpsideDown: + default: + imageName = [imageName stringByAppendingString:@"-Portrait"]; + break; + } } }