Note that there are some explanatory texts on larger screens.

plurals
  1. POXcode Image Assets return the wrong image for retina devices
    primarykey
    data
    text
    <p>I've got an image assets catalog in Xcode 5 and two images in it. <img src="https://i.stack.imgur.com/53bBo.png" alt="enter image description here"></p> <p>This is what the folder structure looks like </p> <p><img src="https://i.stack.imgur.com/PcTii.png" alt="enter image description here"></p> <p>This is the contents of the json file:</p> <pre><code>{ "images" : [ { "idiom" : "ipad", "scale" : "1x", "filename" : "background.png" }, { "idiom" : "ipad", "scale" : "2x", "filename" : "background@2x.png" } ], "info" : { "version" : 1, "author" : "xcode" } } </code></pre> <p>The assets catalog is the only place where I have the background and a file that's named background.png. Now whenever I do a </p> <pre><code>[UIImage imageNamed:@"background"]; </code></pre> <p>On a non retina iPad I get the non retina version and on a retina iPad I get the non retina version again. I use this technique with all of my other resources as well and it correctly loads the right image for retina/non retina everywhere, except for this one.</p> <p>If I do </p> <pre><code>[UIImage imageNamed:@"background@2x"] </code></pre> <p>it loads the retina version of the image and at this point the only solution that I see is to just check the scale and load the appropriate image, but I'd really like this to work.</p> <p>Any ideas?</p> <p><strong>Edit</strong>:</p> <p>Here's a link to a sample project, showing the issue <a href="https://www.dropbox.com/s/7btspn5qsb07wdk/AssetsCatalogWrongImageLoad.zip" rel="nofollow noreferrer">AssetsCatalogWrongImageLoad</a></p> <p><strong>Edit 2</strong> Seems like it doesn't have anything to do with the asset catalog. [UIImage imageNamed] just doesn't work with these two images, even if they are on their own...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload