gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 22:48:21 25 4
gpt4 key购买 nike

我在 iphone 中有一个应用程序,其中我使用背景中的大部分静态图像作为它自己的背景图像中的图像。意味着包含所有静态事物的单个背景图像。现在我想迁移到 iphone 5 also.Now I am using an image of 640*960 images as the background image.if I change that to 640*1136 then when it used in 4serieses of iphone the image will shrink i think.Let it i fixing the frame size 通过检查屏幕。有人能帮我解决这个问题吗?

最佳答案

要知道,你应该使用什么样的图像(iPad 768x1024,iPhone 320x480,等等)您可以检测设备,然后设置相应的图像。

您可以使用这篇 SO 文章区分 iPad/Retina/iPhone:

Detect retina screen/iPhone 4 in iPhone SDK

您可以使用这篇 SO 文章中的示例检测 iPhone 5:

How to detect iPhone 5 (widescreen devices)?

如果你只支持纵向,你可以用这个简单的方法检查:

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
}

当然 - 正如 Valeriy Van 提到的,您需要将 Default-568h@2x.png 图像添加到您的包中。

关于iphone - 如何为 iPhone 5 屏幕分辨率迁移应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12596818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com