2

I am testing some old apps on the iPhone 5 simulator. Most of the apps display properly, that is the display centered, maintaining the original iPhone aspect with blank space on the top and bottom.

One of my apps acts differently. It stretches the launch image (an old 2:3 aspect launch image) to the full height top to bottom of the iPhone 5 simulator. Then it snaps the app to the top of the window, as opposed to centering it.

I suspected this had something to do with auto-layout, but as far as I can tell, being new to the concept, it is disabled. As I checked in the file inspector and "use auto layout" is unselected.

Any thoughts? Thanks for reading!

OWolf
  • 5,012
  • 15
  • 58
  • 93

6 Answers6

5

Removing Default-568h@2x.png from the project should solve the problem. It seems like several people have been having a problem with Xcode auto-creating this launch image.

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
  • Thanks! I did have that image. I think I actually may have created this myself while experimenting, not sure. I just deleted it and I have the same result though, but I think you set me on the right track. – OWolf Sep 21 '12 at 05:09
  • 2
    Remember to delete the app from the iPhone/simulator after deleting the `Default-568h@2x.png` file. It didn't work for me until I finally deleted the app and rebuild it. – ThomasCle Nov 14 '12 at 12:52
1

From my experience it looks like when you open a project in XCode 4.5 it automatically adds a flag to each view saying "Autoresize subviews" and by default this is set to true. When I disable this flag for all my views, they no longer stretch. Interestingly though, I don't get the letterboxing in the simulator, instead a get a white band at the bottom.

Jacob Joz
  • 732
  • 1
  • 11
  • 29
0

I ended up manually setting up the views for the iPhone 5 because I could not locate or fix the issue. Setting up the views specifically for the iPhone 5 was relatively easy, but frustrating to not know why it was necessary in this case.

I detected the iPhone 5 using the code below found in this stack overflow answer: How to detect iPhone 5 (widescreen devices)?

#define IS_IPHONE_5 ( [ [ UIScreen mainScreen ] bounds ].size.height > 500)

if (IS_IPHONE_5 ) {
    //set up views
}
Community
  • 1
  • 1
OWolf
  • 5,012
  • 15
  • 58
  • 93
  • 1
    You might want to add an iPad check into that just in case you ever use it in a universal app. As currently constructed it would return true on any iPad. – Paul Kehrer Sep 22 '12 at 15:03
0

Remove the Default-568h@2x.png from the project, and also, you must manually remove the app from the simulator before running it again from Xcode. It looks like ios6 saves some kind of a flag for the installed apps that makes it think it should stretch it.

Spartak
  • 139
  • 3
  • 2
0

Simply removing the Default-568h@2x.png did not solve my problem. First I deleted this file, than I drag a 640x1136 image to the "Launch images - Retina (4-inch)" of "iPhone Deployment Info" section in Xcode.

0

In iOS 7 Sdk if your are not added launch image in your project you need to Add launch image (640 X 1136 and 640 X 960)into your project, Then go to General Tab and set both launch image (Retina, Retina 4 inch) then remove app from simulator and run again should solve the problem

Jugal K Balara
  • 917
  • 5
  • 15