@@ -40,7 +40,12 @@ - (void)onAppWillResignActive:(UIApplication *)application
40
40
imageView = [[UIImageView alloc ]initWithFrame:[self .viewController.view bounds ]];
41
41
imageView.contentMode = UIViewContentModeScaleAspectFill;
42
42
[imageView setImage: splash];
43
-
43
+
44
+ if ([self isUsingCDVLaunchScreen ]) {
45
+ // launch screen expects the image to be scaled using AspectFill.
46
+ imageView.contentMode = UIViewContentModeScaleAspectFill;
47
+ }
48
+
44
49
#ifdef __CORDOVA_4_0_0
45
50
[[UIApplication sharedApplication ].keyWindow addSubview: imageView];
46
51
#else
@@ -75,13 +80,27 @@ - (CDV_iOSDevice) getCurrentDevice
75
80
return device;
76
81
}
77
82
83
+ - (BOOL ) isUsingCDVLaunchScreen {
84
+ NSString * launchStoryboardName = [[NSBundle mainBundle ] objectForInfoDictionaryKey: @" UILaunchStoryboardName" ];
85
+ if (launchStoryboardName) {
86
+ return ([launchStoryboardName isEqualToString: @" CDVLaunchScreen" ]);
87
+ } else {
88
+ return NO ;
89
+ }
90
+ }
91
+
78
92
- (NSString *)getImageName : (UIInterfaceOrientation)currentOrientation delegate : (id <CDVScreenOrientationDelegate>)orientationDelegate device : (CDV_iOSDevice)device
79
93
{
80
94
// Use UILaunchImageFile if specified in plist. Otherwise, use Default.
81
95
NSString * imageName = [[NSBundle mainBundle ] objectForInfoDictionaryKey: @" UILaunchImageFile" ];
82
96
83
97
NSUInteger supportedOrientations = [orientationDelegate supportedInterfaceOrientations ];
84
-
98
+
99
+ // Detect if we are using Launch Storyboard and return the associated image instead
100
+ if ([self isUsingCDVLaunchScreen ]) {
101
+ imageName = @" LaunchStoryboard" ;
102
+ return imageName;
103
+ }
85
104
// Checks to see if the developer has locked the orientation to use only one of Portrait or Landscape
86
105
BOOL supportsLandscape = (supportedOrientations & UIInterfaceOrientationMaskLandscape);
87
106
BOOL supportsPortrait = (supportedOrientations & UIInterfaceOrientationMaskPortrait || supportedOrientations & UIInterfaceOrientationMaskPortraitUpsideDown);
0 commit comments