Saturday, February 16, 2013

iPhone 5 - changing to, and running on.

So, I decided to submit my app, and they came back saying they needed screenshots for an iPhone 5. It's always something! So, when I ran it on an iPhone 5 simulator, of course the bottom of the display is all white, because the display is longer. I think this is going to be yet another painful process, because I vaguely remember struggling to get the background, which is based on a ragged, parchment kind of motif to fit. It other, this is going to *SUCK*.

Anyway, we'll never know until we try. So, let's google something basic like convert app to iphone 5.

"You definitely need to install XCode 4.5, and to create a new splash image for the 4-inch screen, called Default-568h@2x.png.
You shouldn't change the size of your xibs, because you'll want your app to work on both old and new phones. However, you may want to change the autoresizing masks of some of the views in your xibs so that they stretch to fill the larger screen."

I'm on 4.6, so that's not an issue. This new splash image, I don't have any idea.

It would be nice if I just have to change some autoresizing masks.

This one has a ton of upvotes:


  1. Download and install latest version of Xcode.
   // I did that recently

  1. Set a 4-inch launch image for your app.
// This must be "create a new splash image for the 4-inch screen, called Default-568h@2x.png."

  1. This is how you get 1136 px screen height (without it, you will get 960 px with black margins on top and bottom).
// 960 must be the 3.5 

  1. Test your app, and hopefully do nothing else, since everything should work magically if you had set auto resizing masks properly.
// 

  1. If you didn't, adjust your view layouts with proper auto resizing masks or look into Auto Layout if you only want to support iOS 6 going forward.

  1. If there is something you have to do for the larger screen specifically, then it looks like you have to check height of [[UIScreen mainScreen] bounds] (or applicationFrame, but then you need to consider status bar height if it's present) as there seems to be no specific API for that.

Example:
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568) {
    // code for 4-inch screen
} else {
    // code for 3.5-inch screen
}
Also note: The auto-rotation API has changed completely, take a look at that as well if your application supports any rotation other than default.
// Ok, let's create an image called Default-568h@2x.png that's 4 inches high (why's it named
// 568, which is 1/2 1036 px?

Hmm - what's my current splash screen named?

So, I found an older blog which says there's a function built-in to iOS which automatically loads the splash screen, no coding needed. The iPhone 4 splash is 960 by 640, which is easy to remember because 960 is just like 9630 without the 3 and 640 is like 6420 without the 2. Also, the 6 in 960 is the first digit of the 640.

More good info:
"The splash screen image should be in PNG format. By default, you should name the image file for lower screen resolution as “Default.png”. For the image intended for Retina Display (i.e. 640 x 960 screen resolution), name the file as “Default@2x.png”. The “@2x” is a standard scale modifier used in iOS. All image files designated for displaying in Retina Display should name with the optional string “@2x”.

Let's see if I have anything named that...no such luck.

Ok, let's display it in the simulator - command - s saves it directly to the desktop. Then, double-click on the image and brings it up automatically in preview. Go to tools, size and see it's very nicely in 960 x 640. So, next step is see how to get it into the app. to display.


Ok, well, the splash page works. Of course, the others don't.  I'll tackle them in my next post.  








No comments:

Post a Comment