简体   繁体   English

如何迁移iPhone 5屏幕分辨率的应用程序?

[英]How to migrate apps for iPhone 5 screen resolution?

我在iphone中有一个应用程序,我在后台使用大部分静态图像作为背景图像中的图像。它是一个单一的背景图像,包​​括所有的staic things.now我也想迁移到iphone 5。现在我正在使用640 * 960的图像作为背景图像。如果我将其更改为640 * 1136,那么当它在iphone的4个系列中使用时,我认为图像会缩小。让我通过检查屏幕修复框架尺寸。任何人都可以帮我解决这个问题吗?

To know, what kind of image You should use (for iPad 768x1024, for iPhone 320x480, etc..) You can detect device, and then set corresponding image. 要知道,您应该使用哪种图像(适用于iPad 768x1024,适用于iPhone 320x480等)。您可以检测设备,然后设置相应的图像。

You can distinguish between iPad/Retina/iPhone using this SO article: 您可以使用此SO文章区分iPad / Retina / iPhone:

Detect retina screen/iPhone 4 in iPhone SDK 在iPhone SDK中检测视网膜屏幕/ iPhone 4

You can detect iPhone 5 using example in this SO article: 您可以使用此SO文章中的示例检测iPhone 5:

How to detect iPhone 5 (widescreen devices)? 如何检测iPhone 5(宽屏设备)?

If you have only portrait supported, You can check using this simple method: 如果您只支持肖像,则可以使用以下简单方法进行检查:

if([[UIScreen mainScreen] bounds].size.height == 480)
{
    //iPhone, iPhone retina
}
else if([[UIScreen mainScreen] bounds].size.height == 1024)
{
    //iPad, iPad retina
}
else //568 height
{
    //iPhone 5
}

And of course - as Valeriy Van mentioned, You need Default-568h@2x.png image added to your bundle. 当然 - 正如Valeriy Van所说,你需要将Default-568h@2x.png图像添加到你的包中。

There is no connection between image resolution and size of UIImageView. 图像分辨率与UIImageView的大小之间没有关联。 Image will be rescaled or positioned inside view bounds depending on contentMode property. 图像将根据contentMode属性重新缩放或定位在视图边界内。

What you need first - add Default-568h@2x.png image of 640x1136 as Launch Image for Retina 4 inch. 你需要的是什么 - 添加640x1136的Default-568h@2x.png图像作为Retina 4英寸的启动图像。 If springs and struts of your views are set right, everything will work as granted. 如果您的视图的弹簧和支柱设置正确,一切都将按照授予的方式工作。

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

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