首页 > 解决方案 > @3x 图片,Iphone 8 Plus,Iphone X

问题描述

假设,我在 Xcode 的 Main.storyboard 上选择了“查看为:iPhone 8 Plus”。我们知道这些细节:

Iphone X: 375 x 812 points (@3x) 1125x2436 pixels
Iphone 8 Plus: 414 x 736 points (@3x) 1242 × 2208 pixels
Iphone 8: 375 x 667 points (@2x) 750x1334 pixel

假设我想放置一个 UIImageView (顶栏,标题栏图像),如下所示:

棕色矩形是一个图像(标题栏)

请记住,我选择了“查看方式:iPhone 8 Plus”。所以图像的宽度必须是 414 点。让我们假设图像的高度是 100 点。所以图像大小必须是 1242 x 300 像素。(因为 414points*3=1242px,100points*3=300px)

所以,

@3xBackground.png must be 1242 x 300 pixels.
    @2xBackground.png must be 828x200, right? **(this is question 1)**
    @1xBackground.png must be 414x100, right? **(this is question 2)**

iPhone X 怎么样?Iphone X 也使用@3xBackground.png 图像,对吗?(这是问题3)

我在 iphone 8 plus 上看到这张图片非常清晰。因为我创建了这个关于 iPhone 9 plus 的图像。但我无法在 iPhone x 中看到如此清晰的图像。因为 iPhone X 的宽度是 375 点(1125 像素),但我的图像宽度是 414 点(1242 像素)对吗?iphone x 和 iphone 8 plus 使用相同的图片:@3xBackground.png。设备尝试将 1242 像素的图像放入 1125 像素的位置。那么这张照片怎么看起来这么锐利呢?

将 1242 像素图像放入 1125 像素位置时,Iphone X 是否会降低图像高度?(这是第 4 题)如果回答是。所以应该没问题。

标签: iosxcode

解决方案


推荐阅读