How to determine the size of 1x, 2x and 3x images depending on the size of the corresponding UIImageView?

My request consists of two parts:

1) simple and simple, how do we determine image sizes 1x, 2xand 3x?

I found this SO question closest

what-should-be-3x-images-of- 100x100size UIimageVieworUIButton

but there is no accepted answer in this, so I'm a little confused if it really is the way it is Therefore, if I have a UIImageView of size, let's say, 17 X 21 So my 1x will be 17X21, 2x be 34X42and 3xbe 51X63?

2) If so, then the sizes will be in the event that the size of my UIImageView will also vary depending on the screen size.

So, for iPhone 4s 320X480, if mine UIimageViewwas 17X21, for iPhone 6 375X667it will be20X29

So, how do I determine the dimensions of my image ( 1x, 2x & 3x), which are suitable for all device sizes?

PS: Actually, many thanks in advance, because this may sound a very simple question, but I really hit my head hard on it, but I can’t find a specific satisfactory answer even after searching and reading it many times.

+4
source share
2 answers

You should think in points , not pixels.

1

UIImageView 17x21 , 3 17x21 , 34x42 51x63 . , .

2

, Graphic. , , - . .

+1

, .

.

, Xcode.The , iPhone' .

4s, 1 px 1 . 5, Se, 6, 1 2 px 6s, 7s, 1 3 .

2 , .

1

, 100x100 iPhone Xcode. :

1x 100x100 Ps Sketch. 2x 200x200 Ps Sketch. 3x 300x300 Ps Sketch.

. . , , .

17x21 4s, 17x21 . 20x29 iPhone 6. 40x58 . - 6 7, - 3 X.

. , 1x 4s, 2x 5, 6, SE, 3x 6 7 .

, 40x58 34x42 (17x21) x 2 iPhone 6. 40x50 , Apple . , . 32x42 40x58, , 40x58.

, .

+1

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


All Articles