有没有办法破解PhoneGap 1.0,让它在iPhone5上显示正确的闪屏,以避免webview的白色闪光?
我可以用
控制闪屏if(navigator.splashscreen) navigator.splashscreen.hide();
但在iPhone5上显示错误的图像。我需要显示Default-568h@2x.png图像。 我知道在PG2中这是固定的,但我想避免更新整个项目。
答案 0 :(得分:1)
我刚刚想出如何在旧的Phonegap中修复此问题,这是一个非常简单的修复方法。在PhoneGapDelegate.m中,找到:
UIImage* image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default" ofType:@"png"]];
imageView = [[UIImageView alloc] initWithImage:image];
[image release];
并替换为:
UIImage* image;
if ([[UIScreen mainScreen] bounds].size.height == 568.0f)
{
image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default-568h@2x" ofType:@"png"]];
}
else
{
image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default" ofType:@"png"]];
}
imageView = [[UIImageView alloc] initWithImage:image];
[image release];
出于某种原因,您需要为iPhone 5图像指定完整的图像名称,就像上面的代码一样。如果仅使用@“Default-568h”指定它,则根本不会加载图像。