PhoneGap iPad 启动屏幕不适合

发布于 2024-08-31 22:06:08 字数 202 浏览 6 评论 0原文

我创建了一个与 iPhone 和 iPad 兼容的应用程序。因为它基于 HTML (PhoneGap),所以应用程序本身对于两种设备来说是相同的(HTML 可以很好地扩展!)。 但是启动屏幕图像在启动时不会填满 iPad 上的显示。

在我的资源文件夹中只有 iPhone 启动图像,对于 iPad 来说太小了,我如何添加另一张对于iPad?

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 the iPad, how can I add an other one for the iPad?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

佞臣 2024-09-07 22:06:09

您需要在应用程序的 info.plist 中指定启动图像文件 (UILaunchImageFile) 属性:

例如,如果您将 UILaunchImageFile~ipad 键的值设置为 iPad,您的文件名应为 iPad-Portrait.pngiPad-Landscape.png。您可以类似地为 iPhone 更改它,或使用 iPhone 的默认值 (Default.png)。

这是在 信息属性列表文件

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.

浅浅淡淡 2024-09-07 22:06:09

嘿,我找到了这个问题的解决方案,使用phonegap 1.9将此代码放入您的应用程序委托中应该可以解决问题:

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];
}

需要在[ super applicationDidFinishLaunching:application ]调用之后进入“applicationDidFinishLaunching”函数。

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.

宛菡 2024-09-07 22:06:09

您需要如上所述指定启动图像,但还要检查以确保构建后启动图标位于正确的位置。构建/运行 PhoneGap 项目后,检查 xcode 中的 Resources 文件夹。我发现我的额外启动屏幕和应用程序图标尚未在构建中移动到那里。当我手动复制它们并重新构建后,所有图标和启动屏幕都像 ipad 和 iphone 一样工作。

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.

失退 2024-09-07 22:06:09

我也有同样的问题。我尝试了一大堆解决方案,这些解决方案是在这里和网上提出的。什么都没起作用。我的问题是我正在使用部署目标 < iOS 3.2 不支持他的帖子中描述的 Info.plist 设置Mo.

不幸的是,Apple 有几个关于 Info.plist / 闪屏问题的文档。这一个有帮助:

http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BuildTimeConfiguration/BuildTimeConfiguration.html#//apple_ref/doc/uid/TP40007072-CH7-SW18

您可以这样设置您的项目:
在 Info.plist 中不要进行“启动图像”设置。只需添加以下图像:

Default.png -->这是(大)iPad 启动图像

Default-Landscape.png -->这是(大风景)iPad 初始图像

Default-Portrait.png -->这是(大肖像)iPad 启动图像

Default~iphone.png -->这是(小)iPhone 初始图像

为了支持高分辨率显示:

Default@2x~iphone.png --> -->这是(视网膜)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

彩扇题诗 2024-09-07 22:06:09

您需要将一个名为“Default.png”的文件放入您的资源 - 启动文件夹中。这将删除它,是的,我知道这听起来很愚蠢,因为它是一个 IPAD 应用程序,但如果您不想触及 C 代码,只需添加或替换该文件即可。即使它是 IPAD,它也会被调用(意思是,实际上 default.png 适用于 iphone,但是……无论如何,尝试一下!)

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!)

是你 2024-09-07 22:06:09

我按照有关将 UILaunchImageFile 密钥添加到 .plist 文件 http://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

这可行,但您必须记住将 iPad 图像拖放到 XCode 中。仅仅在文件浏览器中添加文件是不行的,你必须使用Xcode!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文