因为我们的项目设置比较复杂,我无法删除和添加 iOS/Android。我尝试创建了一个新的 Cordova 3.6 项目并安装了新的闪屏插件,但这也没有达到预期效果。
虽然我可能没有找到最佳解决方案,但我已经解决了这个问题。在 iOS 项目的 CordovaLib/CDVAvailability.h 文件中,我添加了两行代码:
#define CDV_IsIPhone6Plus() ([[UIScreen mainScreen] bounds].size.height == 736 && [[UIScreen mainScreen] bounds].size.width == 414)
#define CDV_IsIPhone6() ([[UIScreen mainScreen] bounds].size.height == 667 && [[UIScreen mainScreen] bounds].size.width == 375)
然后在我的CDVSplashScreen.m文件中,我进行了更改:
if (CDV_IsIPhone5()) {
imageName = [imageName stringByAppendingString:@"-568h"];
}else if (CDV_IsIPad() && isOrientationLocked) {
switch (orientation) {
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
imageName = [imageName stringByAppendingString:@"-Landscape"];
break;
case UIInterfaceOrientationPortrait:
case UIInterfaceOrientationPortraitUpsideDown:
default:
imageName = [imageName stringByAppendingString:@"-Portrait"];
break;
}
}
To:
if (CDV_IsIPhone5()) {
imageName = [imageName stringByAppendingString:@"-568h"];
}else if(CDV_IsIPhone6Plus()){
imageName = [imageName stringByAppendingString:@"-568h"];
}else if(CDV_IsIPhone6()){
imageName = [imageName stringByAppendingString:@"-568h"];
} else if (CDV_IsIPad() && isOrientationLocked) {
switch (orientation) {
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
imageName = [imageName stringByAppendingString:@"-Landscape"];
break;
case UIInterfaceOrientationPortrait:
case UIInterfaceOrientationPortraitUpsideDown:
default:
imageName = [imageName stringByAppendingString:@"-Portrait"];
break;
}
}
不确定为什么568h图片正常工作,但我尝试指定736和667图片,但没有成功。只需添加这两行代码即可使iPhone 6+和6的启动画面正常工作。
不幸的是,这种解决方案只适用于每个项目,因为它涉及编辑Cordova源文件。
xcode6
和cordova 3.6.3
吗? - Dawson Loudoncordova 3.6.3
。 - Dawson Loudon