简体   繁体   中英

images size does not change on different screens Xcode

I have created a layout that looks the same in all screen sizes. The layout has lots of views that help me with creating gaps and placeholders for images. For each image I added 3 sizes - X1, X2 and X3 in the assets folder. But from some reason Xcode/Swift does not show them in the corresponding size. In all screen sizes they are located in their correct X and Y positions but their size is small. Any idea what I should do? I am adding some screen shots so you can see what I am talking about.

在此输入图像描述

在此输入图像描述

You have mistaken the sizes in the asset catalog for sizes to be used in the app. Different devices have different resolutions. Older iPhones and iPads have a relationship of 1 point to 1 pixel. Retina devices such as iPads and iPhones have 1 point represented by 2 pixels. And the iPhone+ sizes have 1 point represented by 3 pixels.

In order to have nicely rendered not pixelated images across these devices, you provide your image at three sizes. The 1x will be used on older devices, the 2x will be used on retina devices and the 3x on plus size iPhones.

If you need to provide different sized images you actually need to create new entries for those sizes in the asset catalog, name them differently and load the ones you need to use at run time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM