@@ -38,6 +38,11 @@ - (void)onAppWillResignActive:(UIApplication *)application
3838 } else {
3939 imageView = [[UIImageView alloc ]initWithFrame:[self .viewController.view bounds ]];
4040 [imageView setImage: splash];
41+
42+ if ([self isUsingCDVLaunchScreen ]) {
43+ // launch screen expects the image to be scaled using AspectFill.
44+ imageView.contentMode = UIViewContentModeScaleAspectFill;
45+ }
4146
4247 #ifdef __CORDOVA_4_0_0
4348 [[UIApplication sharedApplication ].keyWindow addSubview: imageView];
@@ -47,6 +52,17 @@ - (void)onAppWillResignActive:(UIApplication *)application
4752 }
4853}
4954
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+
5066// Code below borrowed from the CDV splashscreen plugin @ https://github.com/apache/cordova-plugin-splashscreen
5167// Made some adjustments though, becuase landscape splashscreens are not available for iphone < 6 plus
5268- (CDV_iOSDevice) getCurrentDevice
@@ -83,6 +99,12 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
8399
84100 NSUInteger supportedOrientations = [orientationDelegate supportedInterfaceOrientations ];
85101
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+
86108 // Checks to see if the developer has locked the orientation to use only one of Portrait or Landscape
87109 BOOL supportsLandscape = (supportedOrientations & UIInterfaceOrientationMaskLandscape);
88110 BOOL supportsPortrait = (supportedOrientations & UIInterfaceOrientationMaskPortrait || supportedOrientations & UIInterfaceOrientationMaskPortraitUpsideDown);
0 commit comments