How to handle iphone screen sizes/resolution for background images

家住魔仙堡 提交于 2019-11-26 11:38:57

问题


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?


回答1:


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

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.

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

Feel free to ask anything. :-)



来源:https://stackoverflow.com/questions/48483934/how-to-handle-iphone-screen-sizes-resolution-for-background-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!