Question

In the Xcode I have like this:

screenshot

In a MyViewController.m I am loading the image and nicely it is loaded the @2x when needed ( on retina)

tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"emptyList.png"]];

I would like to add another file which would be loaded only on the iPhone 5's 4" screen. Is that possible? How can I do it?

Was it helpful?

Solution

The question is not very clear but what I am assuming you are asking is: What is the naming convention for iPhone 5 specific images?

We already know we can target iPad/iPhone and the retina/standard display of those devices using the:

.png
@2x.png
~iphone.png
~ipad.png

etc.

Well the question about iPhone 5 specific images has been discussed at length on the Apple Developer Forums, and it's clear there is no way to do this.

Notably, one clue was that the Default.png file to trigger 4" compatible apps had to be named Default-568h@2x.png which triggered a lot of devs thinking that adding the suffix "-568h@2x.png" was the way to go. It's not. You can find this discussion here on the Apple Developer Forums.

Usually people look for this as a solution hoping to adapt for the larger screen with larger images. However, you should implement iOS 6's AutoLayout feature. Remember the iPhone 5's OS is at min iOS 6, you can also implement your layout with springs and struts otherwise.

This should be sufficient for scaling to the larger screen. If you wish to have a different layout altogether for the larger screen, you can detect the screen size and adapt accordingly. You can also specify in Xcode a different nib file to use on the 4" screen. Hope this helps.

More info on this thread from the Apple Developer Forums.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top