0

this problem still hasn't been answered. when using the asset catalog, device specific (not universal), the options are 1x, 2x, r 2x, 3x. 1x is unnecessary as it is not retina. 2x is the well for ip4 with a res 640x960. r 2x is the well for ip5 with a res 640x1136. 3x is the ip6plus well with a res of 1242x2208.

now when i run the simulator for ip6 (not ip6plus!), it uses the 2x image (640x960 res for ip4) and it is also not upscaling to fill the screen (which wouldn't make sense anyhow as the ratios don't fit).

has anyone found a proper guide for setting up background images for the new phones? i don't mean the explanation how the various res sizes are scaling, that's clear, but how to work around the obvious mismatch between the xcassets image well @2x that shares ip4 and ip6? thanks!

edit: Xcode asset catalog support for 3.5", 4", and 4.7" @2x images? similar question but not really solved, just a workaround by using universal instead of device specific. anyone know a better way?

Community
  • 1
  • 1
vive
  • 31
  • 3
  • Sorry to say dude it has been answered multiple times here's one that should help http://stackoverflow.com/questions/25755443/iphone-6-plus-resolution-confusion-xcode-or-apples-website-for-development – Popeye Oct 28 '14 at 09:30
  • 1
    yes i know the scaling, but that wasn't really my question. – vive Oct 28 '14 at 09:48
  • I don't understand your question then based on the what you have put and the answers already given it seems like that the answers on that question should provide you with what you want. If it is not please provide additional information so we can provide better answers. – Popeye Oct 28 '14 at 09:52
  • 2
    the res scaling is clear and launch images work fine within asset catalog, but using the very same principle and adding images according to the devices to their respective wells 1x, 2x, r 2x, 3x, with proper scaling, still does not answer how to load the 750x1334 image for ip6. the simulator takes the 640x960 image in the 2x well and uses it as background for ip6, which is the wrong image and not blown up. – vive Oct 28 '14 at 10:03
  • Oh ok, I think I understand now. To be honest that wasn't clear enough in your question. Maybe it might be best to rephrase your question? – Popeye Oct 28 '14 at 10:13
  • ok, thanks, i edited and hope it is clear now. – vive Oct 28 '14 at 10:23
  • @vive did you get any solution for this problem? – Khawar Nov 11 '14 at 06:44

3 Answers3

2

I have reported a bug to Apple about this since mid November 2014 and I just noticed they marked it as No Value... which gives me the impression Apple has omitted an additional slot for iPhone 6 on purpose. My guess is they now want the 2x slot to be used for iPhone 6, and maybe they're reducing support for iPhone 4s as it's getting old.

If you really want to keep supporting the iPhone 4s, I'd suggest to use iPhone 6 sized images in the 2x slot, and then use the following method to load your images:

+(UIImage *)loadImageNamed:(NSString *)imageName
{
    CGSize screenSize = [UIScreen mainScreen].bounds.size;
    CGFloat screenHeight = MAX(screenSize.width, screenSize.height);
    CGFloat const IPHONE_4_SCREEN_HEIGHT = 480;
    UIImage *image = [UIImage imageNamed:imageName];
    if(screenHeight == IPHONE_4_SCREEN_HEIGHT) {
        CGFloat const xScale = .85333333;//x conversion ratio from iPhone 6's 375 pts width screen to iPhone 4's 320 pts width screen
        CGFloat const yScale = .71964018;//y conversion ratio from iPhone 6's 667 pts height screen to iPhone 4's 480 pts height screen
        CGSize newSize = CGSizeMake(xScale * image.size.width, yScale * image.size.height);
        UIGraphicsBeginImageContextWithOptions(newSize, NO, 0);

        [image drawInRect:(CGRect){0, 0, newSize}];
        UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return resizedImage;
    }
    return image;
}

Resizing a big image (iPhone 6) to a smaller one (iPhone 4s) doesn't lose much quality even if the aspect ration is not the same.


Edit:

This is Apple Relations answer to my bug report:

There are no plans to address this based on the following:

We introduced size classes in IB. As such, we want developers to use an XIB with an image view that controls how an image is loaded and displayed. In the event that they absolutely must provided pixel perfect images for all possible screen sizes, then they need to do something like what you suggested and determine the specific resources to load themselves.

We are now closing this report.

If you have questions about the resolution, or if this is still a critical issue for you, then please update your bug report with that information.

Please be sure to regularly check new Apple releases for any updates that might affect this issue.

ALTN
  • 659
  • 9
  • 26
0

Add image of 640*1136 as ip6 is somewhat proportional to ip5 not ip4 and for iphone 6 there is option for @3x also

0

You can't add @2x image to your assets and hope it will fit all your sizes. Backgrounds for eg. iP4 and iP5 are just different so you have to use 2 assets regular/@2x for iP4 and regular/@2/@3 for iP5/6 since they have same ratio (universal case).

Other way is set @2x and R4 but there is nothing like @2x and @2x retina because it would be the same.

Jakub Truhlář
  • 20,070
  • 9
  • 74
  • 84
  • yes, i tried that, but simulator for ip6 always takes the 2x image, not the retina 2x as ip5. – vive Oct 28 '14 at 09:32
  • I dont know your code where you specific the background. Also what the sentence "always takes the 2x image, not the retina 2x" means ... – Jakub Truhlář Oct 28 '14 at 09:37
  • using the xcassets catalog, i specify views for different devices with the option: device specific. that gives me 4 wells: 1x, 2x, retina 2x and 3x. the 1x we can omit, 2x is meant for ip4 (640x960), retina 2x for ip5 (640x1136) and 3x for ip6+. now my simulator uses the 2x image to display for the ip6, whereas i would need the retina 2x image to then be upscaled to fit the ip6. – vive Oct 28 '14 at 09:45
  • You seems bit confused about about _@2x_. There is no meaning 2x and retina2x. _@2x_ is for retina displays (iP4 is retina too) – Jakub Truhlář Oct 28 '14 at 09:53
  • i know but that's apple's spec, that's how they expect to use the asset catalog, unless you know another way. it's the difference between setting up for device specific (1x,2x,r 2x, 3x) and universal (1x, 2x, 3x only). – vive Oct 28 '14 at 09:59
  • then why you don't look at thishttp://stackoverflow.com/questions/18744554/image-assets-catalog-doesnt-recognise-retina-4-photos-in-xcode5 as i say, what you mean is R4 and @2x – Jakub Truhlář Oct 28 '14 at 10:03