From 424e82cde443bb218b302693c6e899e7c7effcbf Mon Sep 17 00:00:00 2001 From: Sean Bollin Date: Wed, 27 Nov 2013 17:14:57 +0900 Subject: [PATCH] CB-4051 fix for splashscreen rotation problem --- src/ios/CDVSplashScreen.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m index bba7deb..3b59627 100644 --- a/src/ios/CDVSplashScreen.m +++ b/src/ios/CDVSplashScreen.m @@ -18,6 +18,7 @@ */ #import "CDVSplashScreen.h" +#import #define kSplashScreenDurationDefault 0.25f @@ -123,6 +124,12 @@ // Use UILaunchImageFile if specified in plist. Otherwise, use Default. NSString* imageName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchImageFile"]; + // Checks to see if the developer has locked the orientation to use only one of Portrait or Landscape + CDVViewController* vc = (CDVViewController*)self.viewController; + BOOL supportsLandscape = [vc supportsOrientation:UIInterfaceOrientationLandscapeLeft] || [vc supportsOrientation:UIInterfaceOrientationLandscapeRight]; + BOOL supportsPortrait = [vc supportsOrientation:UIInterfaceOrientationPortrait] || [vc supportsOrientation:UIInterfaceOrientationPortraitUpsideDown]; + BOOL isOrientationLocked = !(supportsPortrait && supportsLandscape); + if (imageName) { imageName = [imageName stringByDeletingPathExtension]; } else { @@ -131,7 +138,7 @@ if (CDV_IsIPhone5()) { imageName = [imageName stringByAppendingString:@"-568h"]; - } else if (CDV_IsIPad()) { + } else if (CDV_IsIPad() || isOrientationLocked) { switch (orientation) { case UIInterfaceOrientationLandscapeLeft: case UIInterfaceOrientationLandscapeRight: