gpt4 book ai didi

ios - iphone 5 视网膜显示屏

转载 作者:行者123 更新时间:2023-11-28 20:21:14 24 4
gpt4 key购买 nike

我完全不熟悉 iOS 我正在开发一个与 iPhone 5 兼容的应用程序我还想应用背景图像来查看我的问题是我是否需要两种尺寸的两个不同图像????

if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
CGSize result = [[UIScreen mainScreen] bounds].size;
if(result.height == 480)
{
// iPhone 4S background view
}
if(result.height == 568)
{
// iPhone background image

}
}

最佳答案

假设你有 background.png 作为应用程序背景,现在为了支持视网膜设备你应该有一个 background.png 的两倍大小,它将被添加为 background@2x.png 在您的项目文件夹中。 iOS 将根据您拥有的设备自行处理普通图像或视网膜图像的选择!

好的,现在对于高度不等于 iPhone 3G、4、4S 的 iPhone 5 设备,您需要 640(宽度)*1136(高度)的 background.png,因为 iPhone 5 仅支持视网膜 图片。为此,您需要包含 background-568h@2x.png 以将其与其他文件区分开来。

一个启动画面的例子,

Default.png --- Normal devices, iPhone 3G

Default@2x.png --- Retina devices, > iPhone 3G

Default-568h@2x.png --- Retina devices only, > iPhone 4S

它会自动选择特定的启动画面!

关于ios - iphone 5 视网膜显示屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15876749/

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