Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asset catalog images of type Retina 4 2x not presented on iPhone 6

I am using Asset Catalog that includes images of both: 2x, Retina 4 2x and 3x. All of those files are used in the correct devices iPhone 4, 4s => 2x, iPhone 5, 5s => Retina 4 2x, iPhone 6+ => 3x , but iPhone 6 which uses the 2x instead of the Retina 4 2x. Has anyone encountered that issue?

Thanks

[Edited text] The image set is a general image and not a launch screen. No matter whether I use universal or device settings, and no matter if I choose that the 2x Retina 4 is 1334 or 1136, the image presented on iPhone 6 is the one of the regular 2x.

I am adding screen shots of the three different settings I chose and for all three the result was the screen shot of the attached simulator

---------------Screen Shot of Simulator (iPhone 6):---------------

Simulator

---------------Screen shot of settings with Device including 568:---------------

Device with 568

---------------Screen shot of settings with Device including 667---------------

Device with 667

---------------Screen shot of settings with Universal--------------- Universal

---------------Screen shot of settings of the image set (device settings & 667 height image)--------------- enter image description here

---------------Screen shot of the launch pad---------------- enter image description here

like image 699
Shachar Avatar asked Nov 02 '14 18:11

Shachar


2 Answers

From what I can tell, it seems you want to display a full screen image in native resolution.

Yeah I think this might be a known issue. I don't think you can do it with an asset catalog. I ended up doing it like this guy here: https://stackoverflow.com/q/25892207/342756

My app is landscape, mnd my background image which fills the entire screen in native res I just call like this:

[UIImage imageForDeviceWithName:@"myBackground"];

And here is the list of files and resolutions for "myBackground" (again landscape):

I no longer support 1x. This pretty much covers all iOS 7 and iOS 8 devices. Hope this helps.

Cheers!

like image 171
codefan Avatar answered Nov 19 '22 04:11

codefan


This works in Xcode v7.3 and verified in iPhone 4s simulator running iOS v9.3.

To avoid scaling issues, I did the following:

In my Images.xcassets, I created two Images Sets:
intro_screen
intro_screen_4

In the intro_screen I included the following images
1x 320x480
2x 750x1334
3x 1242x2208

In the intro_screen_4 I included only the image for iPhone 4
2x 640x960

In my code, I did the following:

int screenHeight = [ [ UIScreen mainScreen ] bounds ].size.height;

if(screenHeight == 480)
{
    image = [UIImage imageNamed:@"intro_screen_4" ];
}
else {
    image = [UIImage imageNamed:@"intro_screen" ];
}
like image 35
Adrian Silveanu Avatar answered Nov 19 '22 06:11

Adrian Silveanu