@@ -38,6 +38,11 @@ - (void)onAppWillResignActive:(UIApplication *)application
38
38
} else {
39
39
imageView = [[UIImageView alloc ]initWithFrame:[self .viewController.view bounds ]];
40
40
[imageView setImage: splash];
41
+
42
+ if ([self isUsingCDVLaunchScreen ]) {
43
+ // launch screen expects the image to be scaled using AspectFill.
44
+ imageView.contentMode = UIViewContentModeScaleAspectFill;
45
+ }
41
46
42
47
#ifdef __CORDOVA_4_0_0
43
48
[[UIApplication sharedApplication ].keyWindow addSubview: imageView];
@@ -47,6 +52,17 @@ - (void)onAppWillResignActive:(UIApplication *)application
47
52
}
48
53
}
49
54
55
+ - (BOOL ) isUsingCDVLaunchScreen
56
+ {
57
+ NSString * launchStoryboardName = [[NSBundle mainBundle ] objectForInfoDictionaryKey: @" UILaunchStoryboardName" ];
58
+
59
+ if (launchStoryboardName) {
60
+ return ([launchStoryboardName isEqualToString: @" CDVLaunchScreen" ]);
61
+ }
62
+
63
+ return NO ;
64
+ }
65
+
50
66
// Code below borrowed from the CDV splashscreen plugin @ https://github.com/apache/cordova-plugin-splashscreen
51
67
// Made some adjustments though, becuase landscape splashscreens are not available for iphone < 6 plus
52
68
- (CDV_iOSDevice) getCurrentDevice
@@ -83,6 +99,12 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
83
99
84
100
NSUInteger supportedOrientations = [orientationDelegate supportedInterfaceOrientations ];
85
101
102
+ // detect if we are using CB-9762 Launch Storyboard; if so, return the associated image instead
103
+ if ([self isUsingCDVLaunchScreen ]) {
104
+ imageName = @" LaunchStoryboard" ;
105
+ return imageName;
106
+ }
107
+
86
108
// Checks to see if the developer has locked the orientation to use only one of Portrait or Landscape
87
109
BOOL supportsLandscape = (supportedOrientations & UIInterfaceOrientationMaskLandscape);
88
110
BOOL supportsPortrait = (supportedOrientations & UIInterfaceOrientationMaskPortrait || supportedOrientations & UIInterfaceOrientationMaskPortraitUpsideDown);
0 commit comments