1

I've created an imageset in Assets.xcassets named Wallpaper.

Since the app I'm working on will only work on iOS 7 or greater it would be useless to embed non-retina images (The iPhone 4, which has retina, is the oldest device to support iOS 7). This results in a blank spot in my imageset.

Now as I'm trying to set a background to my UIView, I thought that I maybe could use that blank spot as a reference for a fullscreen image for the iPhone 6 (which is now using @2x images).

So I'm looking for a way to make the iPhone 6 use the @1x image, which otherwise wouldn't be used, instead of the @2x image.

Wallpaper imageset Contents.json

{
  "images" : [
    {
      "idiom" : "iphone",
      "filename" : "Wallpaper-iPhone@1x.png",
      "scale" : "1x"
    },
    {
      "idiom" : "iphone",
      "filename" : "Wallpaper-iPhone@2x.png",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "filename" : "Wallpaper-iPhone@2x-568h.png",
      "subtype" : "retina4",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "filename" : "Wallpaper-iPhone@3x.png",
      "scale" : "3x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

I've already tried the following options to reach Wallpaper-iPhone@1x.png but none of them seems to work.

UIImage *Wallpaper = [UIImage imageNamed:@"Wallpaper"];
if([UIScreen mainScreen].bounds.size.height == 667) {

    // 1. Use the image name, this results in (null).
    NSLog(@"%@",[UIImage imageNamed:@"Wallpaper-iPhone@1x.png"]);

    // 2. Add the mainBundle to the path, this also results in (null).
    NSLog(@"%@",[UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/Wallpaper-iPhone@1x.png", [[NSBundle mainBundle] resourcePath]]]);
}
[self.view setBackgroundColor:[UIColor colorWithPatternImage:Wallpaper]];

Wallpaper imageset

Please note:

  • I've already tried to set "subtype" : "667h" in Contents.json, but that doesn't seems to work...
  • I'm aware of the fact that I could use two imagesets to define a iPhone 6 Wallpaper image, but I was wondering if this would work swell.
  • The app needs fullscreen so it won't work with splitview. So using the @1x slot won't cause any trouble on any device.
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Berendschot
  • 3,026
  • 1
  • 21
  • 43
  • Did you even read the question? There's a blank spot in my imageset and a fullscreen wallpaper for the iPhone 6. I thought it would be wise to fill the blank spot with the image and then make the iPhone 6 call that specific image instead of the @2x version (which has the wrong dimensions). – Berendschot Oct 23 '15 at 14:04
  • If the 2x version has the wrong dimensions then the 1x version would have the wrong dimensions, as they are the same dimensions. What on earth difference would using a different _resolution_ make - except to give a worse image? – matt Oct 23 '15 at 14:06
  • No it isn't. The @1x version isn't used at all. Ever. That's why I'm trying to place my iPhone 6 wallpaper at the 1x spot, it can be any dimension. – Berendschot Oct 23 '15 at 14:08
  • I don't think you quite understand what 1x and 2x and 3x mean. These must be identical images at the same size except single, double, and triple in dimensions. These are not slots for you to put in just anything you like. That is the point. If you have a different image, use a different image set. – matt Oct 23 '15 at 14:09
  • @matt I know they aren't 'random-slots' as you may call it, but in the end however it's exactly the way it works. – Berendschot Oct 23 '15 at 14:17
  • But it _isn't_ working. That's what you asked, and I'm answering. Don't do what you're asking to do. – matt Oct 23 '15 at 14:50

0 Answers0