You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2014/01/07 23:36:32 UTC

git commit: CB-4051 fix for splashscreen rotation problem

Updated Branches:
  refs/heads/dev 1560fc86f -> 424e82cde


CB-4051 fix for splashscreen rotation problem


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/424e82cd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/424e82cd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/424e82cd

Branch: refs/heads/dev
Commit: 424e82cde443bb218b302693c6e899e7c7effcbf
Parents: 1560fc8
Author: Sean Bollin <se...@sean-bollin.com>
Authored: Wed Nov 27 17:14:57 2013 +0900
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Tue Jan 7 14:35:25 2014 -0800

----------------------------------------------------------------------
 src/ios/CDVSplashScreen.m | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/424e82cd/src/ios/CDVSplashScreen.m
----------------------------------------------------------------------
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 <Cordova/CDVViewController.h>
 
 #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: