0

PhoneGap 1.0をハックして、iPhone5で正しいスプラッシュ画面を表示し、Webビューの白いフラッシュを回避する方法はありますか?

スプラッシュスクリーンを制御できます

if(navigator.splashscreen) navigator.splashscreen.hide();

しかし、iPhone5では間違った画像が表示されています。Default-568h@2x.png画像を表示する必要があります。PG2でこれが修正されていることは知っていますが、プロジェクト全体を更新することは避けたいと思います。

4

1 に答える 1

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" だけで指定すると画像は一切読み込まれません。

于 2012-12-04T01:30:19.253 に答える