CB-4051 fix for splashscreen rotation problem

This commit is contained in:
Sean Bollin 2013-11-27 17:14:57 +09:00 committed by Shazron Abdullah
parent 1560fc86f8
commit 424e82cde4

View File

@ -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: