[
https://issues.apache.org/jira/browse/CB-10263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15072007#comment-15072007
]
ASF GitHub Bot commented on CB-10263:
-------------------------------------
Github user jcesarmobile commented on a diff in the pull request:
https://github.com/apache/cordova-plugin-splashscreen/pull/69#discussion_r48450551
--- Diff: src/ios/CDVSplashScreen.m ---
@@ -187,7 +187,35 @@ -
(NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
{
imageName = @"Default";
}
-
+
+ // Add Asset Catalog specific prefixes
+ if ([imageName isEqual:@"LaunchImage"])
+ {
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
+ {
+ float screenHeight = [UIScreen mainScreen].bounds.size.height;
+ float screenWidth = [UIScreen mainScreen].bounds.size.width;
+ float maxScreenDimensionSize = MAX(screenHeight, screenWidth);
+
+ if (maxScreenDimensionSize == 480) imageName = [imageName
stringByAppendingString:@"-700"]; // iPhone 4/4s, 3.5 inch screen
+ if (maxScreenDimensionSize == 568) imageName = [imageName
stringByAppendingString:@"-700"]; // iPhone 5/5s, 4.0 inch screen
+ if (maxScreenDimensionSize == 667) imageName = [imageName
stringByAppendingString:@"-800"]; // iPhone 6, 4.7 inch screen
+ if (maxScreenDimensionSize == 736)
+ {
+ imageName = [imageName stringByAppendingString:@"-800"];
// iPhone 6+, 5.5 inch screen
+ if (currentOrientation == UIInterfaceOrientationPortrait
|| currentOrientation == UIInterfaceOrientationPortraitUpsideDown)
+ {
+ imageName = [imageName
stringByAppendingString:@"-Portrait"];
+ }
+ }
+ }
+ else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
+ {
+ if ([UIScreen mainScreen].scale == 1) imageName = [imageName
stringByAppendingString:@"-700"]; // iPad 2
--- End diff --
you can avoid this if, you are appending -700 in both cases
> Fix splashscreen plugin filenames for Asset Catalog
> ---------------------------------------------------
>
> Key: CB-10263
> URL: https://issues.apache.org/jira/browse/CB-10263
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin SplashScreen
> Environment: [email protected]
> Reporter: Sergey Shakhnazarov
> Assignee: Sergey Shakhnazarov
> Priority: Critical
> Labels: ios
>
> {code}
> cordova create test
> cd test
> cordova platform add ios@4
> cordova plugin add https://github.com/apache/cordova-plugin-splashscreen
> {code}
> {code}
> // add to config.xml:
> <platform name="ios">
> <allow-intent href="itms:*" />
> <allow-intent href="itms-apps:*" />
> <splash src="res/screen/ios/Default~iphone.png" width="320"
> height="480"/>
> <splash src="res/screen/ios/Default@2x~iphone.png" width="640"
> height="960"/>
> <splash src="res/screen/ios/Default-Portrait~ipad.png" width="768"
> height="1024"/>
> <splash src="res/screen/ios/Default-Portrait@2x~ipad.png"
> width="1536" height="2048"/>
> <splash src="res/screen/ios/Default-Landscape~ipad.png" width="1024"
> height="768"/>
> <splash src="res/screen/ios/Default-Landscape@2x~ipad.png"
> width="2048" height="1536"/>
> <splash src="res/screen/ios/Default-568h@2x~iphone.png" width="640"
> height="1136"/>
> <splash src="res/screen/ios/Default-667h.png" width="750"
> height="1334"/>
> <splash src="res/screen/ios/Default-736h.png" width="1242"
> height="2208"/>
> <splash src="res/screen/ios/Default-Landscape-736h.png" width="2208"
> height="1242"/>
> <preference name="AutoHideSplashScreen" value="false" />
> <preference name="FadeSplashScreen" value="true"/>
> <preference name="FadeSplashScreenDuration" value="1500"/>
> </platform>
> <preference name="SplashScreenDelay" value="2000" />
> <preference name="ShowSplashScreenSpinner" value="true"/>
> <preference name="Orientation" value="all"/>
> {code}
> {code}
> // add to index.js deviceready event:
> setTimeout(navigator.splashscreen.hide, 3000);
> {code}
> {code}
> cordova emulate ios --target=iPhone-6-Plus
> {code}
> Splash screen will be shown briefly and after that the image will disappear
> leaving only the spinner.
> The following message will be logged out:
> *WARNING: The splashscreen image named LaunchImage-736h was not found*
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]