对于 Web 应用程序,您可以使用 apple-touch-startup-image 设置启动画面。
那么,对于 iPad 呢?
对于 Web 应用程序,您可以使用 apple-touch-startup-image 设置启动画面。
那么,对于 iPad 呢?
这将为您的Web应用程序添加启动画面。下面是iPad和iPhone / iPod Touch以及iPhone 5所需的尺寸,包括状态栏区域。
<!-- iPhone -->
<link href="http://www.example.com/mobile/images/apple-touch-startup-image-320x460.png"
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-touch-startup-image-640x920.png"
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-touch-startup-image-640x1096.png"
media="(device-width: 320px) and (device-height: 568px)
and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image">
<!-- iPad -->
<link href="http://www.example.com/mobile/images/apple-touch-startup-image-768x1004.png"
media="(device-width: 768px) and (device-height: 1024px)
and (orientation: portrait)
and (-webkit-device-pixel-ratio: 1)"
rel="apple-touch-startup-image">
<link href="http://www.example.com/mobile/images/apple-touch-startup-image-748x1024.png"
media="(device-width: 768px) and (device-height: 1024px)
and (orientation: landscape)
and (-webkit-device-pixel-ratio: 1)"
rel="apple-touch-startup-image">
<!-- iPad (Retina) -->
<link href="http://www.example.com/mobile/images/apple-touch-startup-image-1536x2008.png"
media="(device-width: 768px) and (device-height: 1024px)
and (orientation: portrait)
and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image">
<link href="http://www.example.com/mobile/images/apple-touch-startup-image-1496x2048.png"
media="(device-width: 768px) and (device-height: 1024px)
and (orientation: landscape)
and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image">
如果要创建一个兼容iPad的Web应用程序,建议同时使用横向和纵向尺寸。
竖向图片需要768x1004(注意:1004而不是1024,20px用于状态栏),首选文件格式为PNG。
横向图片需要1024x748(注意:748再次为状态栏留出20px)。然后需要将此图像顺时针旋转90度,最终结果为748x1024。
头部链接标签应如下所示:
<link rel="apple-touch-startup-image" href="images/splash_screen_768x1004.png" media="(device-width: 768px) and (orientation: portrait)" />
<link rel="apple-touch-startup-image" href="images/splash_screen_1024x748.png" media="(device-width: 768px) and (orientation: landscape)" />
对于新的Retina iPad(如果您不添加这些内容,它将使用上面的像素加倍):
<link rel="apple-touch-startup-image"
href="images/splash_screen_1536x2008.png"
media="(device-width: 1536px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)" />
<link rel="apple-touch-startup-image"
href="images/splash_screen_2048x1496.png"
media="(device-width: 1536px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)" />
在我发布这篇文章时,以前的答案(包括被采纳的答案)都无法通过我的测试。
我认为Madhup指的是使用Objective C编写并通过Xcode编译的本地应用程序。 OP正在尝试使其适用于通过Safari添加到主屏幕的Web应用程序。 到目前为止还没有成功 :(
我只能通过制作一个尺寸为748x1024的PNG图像来使启动图像正常工作。这在使用固件3.2.1的iPad上进行了测试。
我能找到的最好的解释是:https://gist.github.com/472519
请注意,只有在为iPhone提供启动图像以及为iPad提供横向/纵向图像时,它才对我起作用。
这与 iPhone 相同。将名为 Default.png
的 PNG 文件放入资源文件夹中。
<link>
标签的特殊处理:http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html#//apple_ref/doc/uid/TP40002051-CH3-SW6 - Ben Zotto
sizes
属性不被理解,您需要使用media
代替。 - Timothy Walters