如何处理iPhone屏幕尺寸/背景图像的分辨率 [英] How to handle iphone screen sizes/resolution for background images
问题描述
iPhoneX之后,我真的在努力支持所有设备的图像大小和命名约定.有什么方法可以在4.7、5.5 snd 5.8屏幕上使用3x图像?全屏图像视图应使用什么确切尺寸?
After the iPhoneX, I am really struggling with the image sizes and naming conventions which supports all devices. Is there any way to use 3x images for 4.7, 5.5 snd 5.8 screens? What are the exact dimensions I should use for an imageview in full screen?
推荐答案
您可以使用.pdf
格式的图像.因此,您只需要管理1x的单比例图像.它会支持所有屏幕尺寸,因此您无需管理1x,2x,3x png.因此,单个图像可以调整所有设备,还可以缩小应用大小.
You can use image with .pdf
format. So you need to manage only single scale image with 1x. It will support all screen sizes so you don't need to mange 1x,2x,3x png. So single image can adjust all devices and also reduce app size.
您可以按照以下简单步骤来实现此方法:
You can follow these simple steps to implement this method:
步骤1:以.png
格式获取尺寸为1x的背景图片,并将其转换为.pdf
文件
Step 1: Get your background image with 1x size in .png
format and convert it to .pdf
file
第2步:在项目的Assets.xcassets
中添加该.pdf
图像,并必须在资产属性中选择单一比例",否则您将无法添加.pdf
格式的图像.
Step 2: Add that .pdf
image in your project's Assets.xcassets
and make you have to select "Single scale" in asset property otherwise you can't add .pdf
formatted image.
第3步:在imageview中添加该图像集,然后使用其他设备进行检查
Step 3: Add set that image in imageview and check with different devices
随时问任何问题. :-)
Feel free to ask anything. :-)
这篇关于如何处理iPhone屏幕尺寸/背景图像的分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!