I created an App which is compatible to iPhone and iPad. Because it is based on HTML (PhoneGap) the App itself is the same for both devices (HTML scales well!). But the launch screen image does not fill out the display on the iPad upon launch.
In my Resorces folder there is only the iPhone launch image which is to small for th开发者_StackOverflow社区e iPad, how can I add an other one for the iPad?
You need to specify the launch image file (UILaunchImageFile
) property in your application's info.plist:
For example, if you set the value for the key UILaunchImageFile~ipad
to iPad
, your file names should be iPad-Portrait.png
and iPad-Landscape.png
. You could similarly change it for the iPhone, or use the default (Default.png
) for iPhone.
This is defined in Information Property List Files.
Hey, I've found a solution to this issue, using phonegap 1.9 dropping this code into your apps delegate should do the trick:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
UIImage* image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default-Portrait" ofType:@"png"]];
imageView = [[UIImageView alloc] initWithImage:image];
[image release];
imageView.tag = 1;
[window addSubview:imageView];
[imageView release];
}
That needs to go in the 'applicationDidFinishLaunching' function after the [ super applicationDidFinishLaunching:application ] call.
You need to specify the launch image as mentioned above, but also check to make sure that after the build your launch icons are in the right place. After doing a Build/Run of a PhoneGap project, check the Resources folder in xcode. I found that my additional launch screens and app icons hadn't been moved there in build. Once I copied them in manually and re-built, all the icons and launch screens worked as they should for ipad and iphone.
I had the same problem. I tried a whole bunch of solutions, which were proposed here and on the net. Nothing worked. My Problem was that I'm using a deployment target < iOS 3.2 which does not support the Info.plist settings Mo. described in his post.
Unfortunately Apple has several documentations on the Info.plist / splash screen matter. This one helped:
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BuildTimeConfiguration/BuildTimeConfiguration.html#//apple_ref/doc/uid/TP40007072-CH7-SW18
You set up your project like this: Make no "Launch image" settings in Info.plist. Just add the following images:
Default.png
--> This is the (big) iPad splash image
Default-Landscape.png
--> This is the (big landscape) iPad splash image
Default-Portrait.png
--> This is the (big portrait) iPad splash image
Default~iphone.png
--> This is the (small) iPhone splash image
To support high-resolution displays:
Default@2x~iphone.png
--> --> This is the (retina) iPhone splash image
you need to put a file called "Default.png" in your resources - splash folder. This will remove it, yes i know it sounds silly, because it's an IPAD app, but if you don't want to touch the C code, just add or replace that file. It get's called even if it's an IPAD (meaning, actually default.png is for iphone, but ...well whatever, just try it!)
I followed the documentation regarding adding the UILaunchImageFile key to the .plist file http://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html .
This works but you have to remember to drag and drop your ipad image into XCode. It will not work by simply adding the file in the file browser, you must use Xcode!
精彩评论