iPhone 5 letterboxing / screen resize


Because I think a lot of people will be asking this question (because I was)...

Now that the latest version of XCode allows us to test our programs on a iPhone 5 simulator, you may have noticed that your app has been "letterboxed," showing black borders on the top/bottom (or left/right, depending on orientation). There is a very simple fix for this (though it is not the proper solution), that will automatically treat your application as though it is built for the new iPhone.

1) Create a new app project. 2) Locate the "Default-568h@2x.png" file inside that projects' folder. 3) Add that file to your project

That's it. Interestingly enough, if you then remove the splash image, it will still work correctly (which tells us that it is not the correct solution, but it does make the correct solution happen in the project). Of course, you could customize that image to whatever you want, but basically that is how you tell iPhone 5 to display the app "fullscreen."

Then, to fix formatting of view size for both kinds of devices, make sure you are using

[[UIScreen mainScreen]bounds];

instead of explicitly stating screen size. IE, if your view frame was CGRectMake(0,0,310,420);

it should be


And just in case you don't know, the new iPhone screen size is 640x1136 (cut in half for non-retina).

The more you know...

ps, someone with a higher level, please add a iphone5 tag to this