简体   繁体   English

苹果触摸启动图像加载错误的分辨率图像

[英]apple-touch-startup-image loading wrong resolution image

I'm doing a Sencha Touch web app with splash screens specified as follows. 我正在使用具有如下指定的初始屏幕的Sencha Touch Web应用程序。 The images are 640x920 and 320x460 respectively (allowing for the statusbar and following an example from Sencha). 图像分别为640x920和320x460(允许状态栏显示,并遵循Sencha的示例)。

<link rel="apple-touch-startup-image" media="screen and (resolution: 326dpi)" href="/resources/img/startup_640.png" />
<link rel="apple-touch-startup-image" media="screen and (resolution: 163dpi)" href="/resources/img/startup.png" />

However, on an iPhone 4, I'm still seeing only the low resolution image. 但是,在iPhone 4上,我仍然只能看到低分辨率的图像。 (To make things easy, I've embedded the text "640x920" and "320x460" in the appropriate image to be sure I'm looking at the right images.) (为简便起见,我在适当的图像中嵌入了文本“ 640x920”和“ 320x460”,以确保查看的图像正确。)

I keep clearing the Safari cache and reloading the app, but the wrong image continues to load. 我一直在清除Safari缓存并重新加载应用程序,但是错误的图像继续加载。

Just to make sure I had them right, I switched the links to point to the opposite files, but then as expected, neither splash loaded. 为了确保我正确使用它们,我将链接切换为指向相反的文件,但随后如预期的那样,没有启动加载。

Any other suggestions? 还有其他建议吗?

EDIT: Similarly, the apple-touch-icon-precomposed is loading the smaller of the two as well. 编辑:同样, apple-touch-icon-precomposed也正在加载两者中较小的一个。

This will add a Splash Screen to your Web App. 这会将启动画面添加到您的Web应用程序。 Below are the sizes you'll need for both iPad and iPhone/iPod Touch, these include the status bar area as well. 以下是iPad和iPhone / iPod Touch所需的尺寸,其中还包括状态栏区域。

<!-- iPhone -->
<link href="http://www.example.com/mobile/images/apple-startup-iPhone.jpg" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 1)" rel="apple-touch-startup-image">

<!-- iPhone (Retina) -->
<link href="http://www.example.com/mobile/images/apple-startup-iPhone-RETINA.jpg" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">

<!-- iPhone 5 -->
<link href="http://www.example.com/mobile/images/apple-startup-iPhone-Tall-RETINA.jpg"  media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">

<!-- iPad Portrait -->
<link href="http://www.example.com/mobile/images/apple-startup-iPad-Portrait.jpg" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 1)" rel="apple-touch-startup-image">

<!-- iPad Landscape -->
<link href="http://www.example.com/mobile/images/apple-startup-iPad-Landscape.jpg" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 1)" rel="apple-touch-startup-image">

<!-- iPad Portrait (Retina) -->
<link href="http://www.example.com/mobile/images/apple-startup-iPad-RETINA-Portrait.jpg" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">

<!-- iPad Landscape (Retina) -->
<link href="http://www.example.com/mobile/images/apple-startup-iPad-RETINA-Landscape.jpg" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">

If creating a Web App for iPad compatibility it's recommended that both Landscape and Portrait sizes are used. 如果创建兼容iPad的Web应用程序,建议同时使用横向和纵向尺寸。

The lack of documentation certainly is frustrating. 缺乏文档的确令人沮丧。 I found a solution and blogged about it here: http://paulofierro.com/blog/2011/8/31/icons-and-splash-screens-for-ios-web-apps-retina-displays-also-welcome 我找到了一个解决方案,并在这里写了博客: http : //paulofierro.com/blog/2011/8/31/icons-and-splash-screens-for-ios-web-apps-retina-displays-also-welcome

Basically the sizes property and media queries will not work. 基本上,sizes属性和媒体查询将不起作用。 You have to inject the high-res startup image via JavaScript once your page is loaded. 页面加载后,您必须通过JavaScript注入高分辨率的启动图像。 Hacky but works. 哈克,但有效。

It seems at this point in time, Apple does not support a retina display resolution startup image. 似乎在这个时候,Apple不支持视网膜显示分辨率启动图像。 According to their docs ... 根据他们的文档 ...

On iPhone and iPod touch, the image must be 320 x 460 pixels and in portrait orientation. 在iPhone和iPod touch上,图像必须为320 x 460像素且为纵向。

Nothing is stated in that article about supporting high-res startup images. 该文章中未提及有关支持高分辨率启动映像的任何内容。

Another good discussion of this issue can be found here . 关于此问题的另一个很好的讨论可以在这里找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM