用于Retina显示的webapp中的启动图像?

Cri*_*spy 12 iphone mobile-safari ios4

有人知道如何让iOS在使用时显示更高分辨率的启动图像吗?目前我仍然坚持使用460x380图像,这在iPhone 4的高dpi显示屏上显示时显然看起来很糟糕.我尝试了@ 2x技巧,但似乎没有用.

任何想法或解决方法?

小智 21

我从来没有想过我会让这个工作,但由于某种原因,网上到处都说高分辨率图像尺寸是640x960,它们实际上是640x920.进行此更改时,高分辨率启动屏幕将在视网膜显示屏上正确显示.以下是我在我们的应用中使用的确切代码.我们在iPad1/iPad2纵向和横向,iPhone3/iPhone4上使用闪屏

希望这有助于某人.

  <!-- iOS Device Startup Images -->
<!-- iPhone/iPod Touch Portrait – 320 x 460 (standard resolution) -->
<link rel="apple-touch-startup-image" href="splash-screen-320x460.png" media="screen and (max-device-width: 320px)" />

<!-- iPhone/iPod Touch Portrait – 640 x 920 pixels (high-resolution) -->
<link rel="apple-touch-startup-image" media="(max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)" href="splash-screen-640x920.png" />

<!-- For iPad Landscape 1024x748 -->
  <!-- Note: iPad landscape startup image has to be exactly 748x1024 pixels (portrait, with contents rotated).-->
<link rel="apple-touch-startup-image" sizes="1024x748" href="splash-screen-1024x748.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)" />

<!-- For iPad Portrait 768x1004 -->
<link rel="apple-touch-startup-image" sizes="768x1004" href="splash-screen-768x1004.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)"/>
Run Code Online (Sandbox Code Playgroud)


Dan*_*Ray -3

“@2x”技巧有效。一定是你的图片出了问题。

你想要两个文件。Default.png 和 Default@2x.png。第一个应该是 320x460。第二个应该是 640x920。我保证它有效。

  • 我说的是原生应用程序的启动屏幕。你问的是这个吗?我看到您在问题标题中使用了“webapp”一词,但您编写的其他所有内容都好像您正在制作本机应用程序一样...... @2x 是针对本机应用程序的。在 Obj-C 中,使用 Xcode 构建。 (2认同)