Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
335 views
in Technique[技术] by (71.8m points)

ios - How to handle iphone screen sizes/resolution for background images

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:

Step 1: Get your background image with 1x size in .png format and convert it to .pdf file

enter image description here

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.

enter image description here Step 3: Add set that image in imageview and check with different devices

enter image description here

Feel free to ask anything. :-)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...