Adding an iOS device @ 1x, @ 2x, @ 3x PER, how?

I recently asked a question about why we use 3 different types of images listed above and got good / detailed answers. It also made me talk about something else ...

Suppose I work in Xcode (with SWIFT) and have three image sizes @ 1x, @ 2x, @ 3x for a specific UIImage on iPhone. Now, I want it to look beautiful on the iPad, so I'm adding some scaling. However, this will resize the 1x, 2x, 3x images I need for the iPad, so I need to do 3 more to compensate for this new size. Now, how will Xcode distinguish between the two? Do I need to check what screen size I use and then select images?

I read that assets can help me, but this only applies to the iPhone vs iPad, what if I scale my images to the iPhone 4, 5, 6 and iPad. The fact that there are a lot of different sizes and @x images, and I read Apple, does not like device verification, so I'm not sure how this will happen.

Hope this makes sense. I get @ 1x, 2x, 3x per device, but if my application is designed for universal use of the device, then how do I manage all these different sizes in the code for the correct device?

+4
source share
2 answers

. . , Apple , :

: , , .

:

. , . , , , . ,

. ,

.

+3

, iPad UIImageView. , 400 * 400pt, 1200 * 1200. . , @2x @1x. 1200 * 1200 - , @3x . . , @1x @2x @3x , , , .

-3

Source: https://habr.com/ru/post/1605790/


All Articles