Image name for retina only?

I already know about the concept of iOS apps without retina and retina . But suppose a project created for a retina device, then usually the image name should be "myImageName@2x.png", but can I use it "myImageName.png"instead "myImageName@2x.png"? There are no image size changes, just the image name "myImageName@2x.png"TO has changed "myImageName.png".

Is it really or not?

+4
source share
3 answers

I will demonstrate this in two situations.

Xib image

xib, , @2x, 2. . refresh.png, , 40 * 40 , xib, : enter image description here   refresh@2x.png, : enter image description here

, scale of UIImage , .

@property (, ) CGFloat scale , @2x, 2.0. , Core Graphics. , 1,0.

( ) , .

: , . , . - , - 2 * 2 . Xib size ( ios 4.0 ). 40 * 40 @2x, 40 * 40 , 1,0. @2x, 20 * 20 , 2,0.

@2x - , .

imageNamed:, scale size UIImage .

+2

. "myImageName.png" "myImageName@2x.png", , ratina "myImageName@2x.png".

"myImageName.png" "myImageName@2x.png", , .

+1

/-, , . , : , @2x, "" ( @2x). , , . , @2x, @2x.

, , , [NSImage imageNamed: imageName], : [NSImage imageNamed: @ "myName" ]. . "myName.png" "myName@2x.png", [NSImage imageNamed: @ "myName.png" ] [NSImage imageNamed: @ "myName@2x.png".

, .

0

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


All Articles