简体   繁体   English

适用于网络应用的iPhone 4 Retina“apple-touch-startup-image”

[英]iPhone 4 Retina “apple-touch-startup-image” for Web-apps

This has been asked multiple times here, but without a solid and understandable answer. 这里已被多次询问,但没有一个可靠且可理解的答案。 This is a web-app , not a native-app. 这是一个网络应用程序 ,而不是本机应用程序。

I'm using: 我正在使用:

<link rel="apple-touch-startup-image" href="images/startup.png" />

to display the startup image. 显示启动图像。 It loads fine if the image's resolution is 320x460. 如果图像的分辨率为320x460,则可以正常加载。 I tried using the retina's resolution which is 640x920 (40px are taken out by the status bar), that didn't work. 我尝试使用视网膜的分辨率640x920(40px由状态栏取出),但没有用。 I've tried the @2x thing, that failed too. 我已经尝试了@2x东西,也失败了。

Is it even possible [yet]? 甚至可能[还]?

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 App,建议使用横向和纵向尺寸。

The documentation (found here ) says: 文档(在此处找到)说:

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

I have tested providing different sizes, but the if the size is not exactly 320x460, the image is simply ignored. 我测试过提供不同尺寸,但如果尺寸不完全是320x460,则图像被忽略。 There is no clear statement from apple whether it is possible to include high res startup images, but forum posts (eg here: Apple Dev Forum ) suggest that it is currently not possible. Apple没有明确声明是否有可能包含高分辨率启动图像,但论坛帖子(例如: Apple Dev Forum )表明目前无法实现。

Just did the testing... apple have added the "sizes" attribute. 刚做了测试......苹果已经添加了“尺寸”属性。 so, for hi-res, you add sizes="640x920", etc. I suppose this works for different orientation too. 所以,对于高分辨率,你添加sizes =“640x920”等。我想这也适用于不同的方向。

This works for me: 这对我有用:

<link rel="apple-touch-startup-image" media="screen and (max-device-width: 320px)" href="images/iphone_splash.png"/>
<link rel="apple-touch-startup-image" media="(max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)" href="images/iphone_splash_hires.png" />

So if I understand well, we actually need 8 different images considering we have 3 parameters to take into account: 因此,如果我理解得很好,我们实际上需要8个不同的图像,考虑到我们有3个参数需要考虑:

  • Device (iPhone or iPad) 设备(iPhone或iPad)
  • Resolution (retina or not) 决议(视网膜与否)
  • Orientation (portrait or landscape) 方向(肖像或风景)

Am I right? 我对吗?

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

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