简体   繁体   English

如何为iphone5设置apple-touch-startup-image?

[英]how to set apple-touch-startup-image for iphone5?

I tried 我试过了

<link href="Images/Default-568h@2x.png" sizes="640x1136" media="(device-width: 640px) and (device-height: 1136px)" rel="apple-touch-startup-image">

But it didn't work. 但它没有用。 And apple's interface guildline hasn't been updated for iphone5. 苹果的界面guildline尚未针对iphone5进行更新。

Anybody knows?Thanks! 有人知道吗?谢谢!

1.Don't use "width=device-width" for viewport, use codes below: 1.不要在视口中使用“width = device-width”,请使用以下代码:

<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">

2.Prepare an image sized 640*1096, save as "Images/Default-568h@2x", add this code to your page's header: 2.准备尺寸为640 * 1096的图像,保存为“Images / Default-568h @ 2x”,将此代码添加到页面的标题中:

<link href="Images/Default-568h@2x.png" rel="apple-touch-startup-image" sizes="640x1096">

Here's a demo, it's compatible with iPhone5: https://github.com/openfibers/php-tot 这是一个演示,它与iPhone5兼容: https//github.com/openfibers/php-tot

The startup image has no direct relationship with the letterboxing. 启动图像与letterboxing没有直接关系。

The solution is to just change the viewport to a different width than device-width or 320. Why? 解决方案是将视口更改为与设备宽度或320不同的宽度。为什么? I don't know, it's really weird but if you just use the next viewport you don't get the letterbox. 我不知道,这真的很奇怪,但如果你只是使用下一个视口,你就不会得到信箱。

<meta name="viewport" content="width=320.1">

The sizes attribute on the apple-touch-startup-image is being ignored so if you want to provide more than one you need to use media queries. apple-touch-startup-image上的sizes属性被忽略,因此如果您想提供多个,则需要使用媒体查询。

Other solution is to just update the viewport using JavaScript when it's an iPhone/iPod 4". 其他解决方案是只使用JavaScript更新视口,当它是iPhone / iPod 4时。

More on the solution and the findings at http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers#updatewebapps 有关解决方案和调查结果的更多信息, 请访问http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers#updatewebapps

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

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