Web 应用程序中用于 Retina 显示的启动图像?

发布于 2024-09-18 16:04:48 字数 134 浏览 1 评论 0原文

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

有什么想法或解决方法吗?

Anybody know how to get iOS to display higher resolution startup image when using ? Currently I'm stuck with 460x380 image which obviously looks horrible when displayed on iPhone 4's high dpi display. I tried the @2x trick but didn't seem to work.

Any ideas or workarounds?

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

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

发布评论

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

评论(5

久伴你 2024-09-25 16:04:48

我从来没有想过我会得到这个工作,但出于某种原因,网上到处都说高分辨率图像尺寸是 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)"/>

I didn't ever think I would get this working, but for some reason, everywhere online states that the hi-res images dimensions are 640x960, they are actually 640x920. When you make this change, the hi-res splash screen will appear correctly on retina displays. Below is the exact code that I use in our app. We have splash screens working on iPad1/iPad2 Portrait and Landscape, iPhone3/iPhone4

Hope this helps someone.

  <!-- 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)"/>
咋地 2024-09-25 16:04:48

您是否尝试过在 link 标记上使用与像素比相关的媒体查询?

media="only screen and (-webkit-min-device-pixel-ratio: 2)" 用于视网膜显示屏。

Have you tried using media queries related to pixel ratio on the link tag?

media="only screen and (-webkit-min-device-pixel-ratio: 2)" for the retina display one.

旧伤慢歌 2024-09-25 16:04:48

iPad:

link rel="apple-touch-startup-image" sizes="768x1004" href="" /
iPhone Retina Display: link rel="apple-touch-startup-image" sizes="640x960" href="" /

iPad:

link rel="apple-touch-startup-image" sizes="768x1004" href="" /
iPhone Retina Display: link rel="apple-touch-startup-image" sizes="640x960" href="" /
落日海湾 2024-09-25 16:04:48

我见过 XCode 在这种情况下出错的情况。除了仔细检查图像大小 (320x460) 之外,还可以:

  1. 确保两个图像都在构建中。 (右键/选项单击文件标题并选择“目标成员身份”,然后确保选中该复选框。)
  2. 执行全新构建。
  3. 删除构建目录中的所有构建文件。 (Clean 并不能获取所有这些内容。)
  4. 从目标手机/SIM 卡中删除应用程序。

我知道这可能看起来很明显或不必要,但我对同样的问题撞了头,清理/删除/删除序列修复了它。

I've seen cases where XCode messes up in this situation. In addition to double checking the image size, (320x460) it doesn't hurt to:

  1. Make sure both images are in the build. (Right/Option click on the files header and select "target membership" and then make sure the checkbox is checked.)
  2. Do a clean build.
  3. Delete all of the build files in your build directory. (Clean doesn't get ALL of them.)
  4. Delete the app from the target phone/sim.

I know this may seem obvious or unnecessary, but I banged my head against the same problem and the clean/delete/delete sequence fixed it.

不必了 2024-09-25 16:04:48

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

你想要两个文件。 Default.png 和[电子邮件受保护]。第一个应该是 320x460。第二个应该是 640x920。我保证它有效。

The "@2x" trick works. Must have been something wrong with your images.

You want two files. Default.png and [email protected]. The first one should be 320x460. The second should be 640x920. I promise it works.

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