No Retina 4 option in xcode 7 then how do I set fullscreen images in asset to make them show correctly in 4s/5s & iPhone 6?
Asked Answered
H

2

1

In xcode 7 these is no retina 4 option, according to this, apple removed it on purpose. I did edit Contents.json to get it back but the effect is not the same! I remember in XCode6/pre-iOS9 iPhone 6 will used retina 4 picture so I only need to set one fullscreen 2x picture for iPhone 4/4s, one fullscreen Retina 4 for iPhone 5/5s and 6.

I think using Retina4 for iPhone 6 really makes sense while 2x doesn't! Because 1334/750 is about 1.778, which is close to 1136/640 = 1.775 while 960/640 = 1.5. My 640*1136 pictures do show properly on iPhone 6 while 640*960 pictures are distorted.

But with Xcode 7 even I got the retina 4 option back, iPhone 6 still use 2x (640*960) picture instead of retina4 picture(iPhone 5/5s does use retina4 and shows properly now). I tried to change device type from iPhone to Universal, same.

So my question is if apple removed retina4 on purpose then how do I set fullscreen images in xasset to make them work for iPhone 4/5/6 ? I am only talking about fullscreen images. I understand for non-fullscreen images using 2x makes sense.

BTW I am not talking about AppIcon & LaunchImage (retina 4 is still there and works). I don't want to write extra code to make it work (actually this is what I currently do, like this Fullscreen images on iPhone 6 with Asset Catalogs) either. So is it possible that I just set asset to make it work ?

Highminded answered 29/10, 2015 at 5:42 Comment(7)
"So I really don't get why apple wants us to use 2x for iPhone 6" Because the iPhone 6 screen is 2x resolution.Pithead
But with 4/4s also use 2x you will face the problem I said!Highminded
But no one here can answer a question about "why apple". That is not a programming question. It is a question about the inner workings of a highly secretive corporation. It is hard to see how any answer could satisfy you. You are not really asking a question; you are just complaining. That's fine, but not on Stack Overflow, please.Pithead
I'm voting to close this question as off-topic because it isn't a programming question, and to whatever extent it might be a programming question it is unanswerable.Pithead
my question is if apple removed retina4 on purpose then how do I set pictures in xasset to make them work for iPhone 4/5/6 ?Highminded
My images "work" just fine on an iPhone 4/5. You have given no reason why they should not.Pithead
But what about iPhone 6 ? How can I make it work and that was my original question.Highminded
H
2

I raised a ticket to apple technical support and they confirmed that currently there is no way to do that. I have to write some code for it. "Currently, there is no way for the Asset Catalog to load device specific images. If your app needs to support device specific images you will need to implement your own code to detect the screen size and choose the appropriate image. You can file an enhancement request by using the following link. Be sure to explain your use case for this feature. "

Highminded answered 13/11, 2015 at 2:7 Comment(0)
D
0

You can modify the JSON that defines an Image Set

  1. In Finder, go to the folder of an image set. You can right-click image set inside Xcode and choose "Show in Finder".
  2. Open Content.json file
  3. Add definition of "Retina 4 2x" on Json in "images" array.

    { "idiom" : "iphone", "subtype" : "retina4", "scale" : "2x" },

For example, a complete empty file ready for iPhone:

{
  "images" : [
    {
      "idiom" : "iphone",
      "scale" : "1x"
    },
    {
      "idiom" : "iphone",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "subtype" : "retina4",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "scale" : "3x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}
Dalrymple answered 28/4, 2016 at 13:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.