3

Possible Duplicate:
How do I support the taller iPhone 5 screen size?

I am new to iPhone and I have a small doubt. Now the iphone5 screen height is 568 and previous iphone's screen height was 480. How can we implement apps for iphone5.Should we check views or controllers all the time for iphone5 and below versions? If am wrong Please correct me.

Thanks in advance.

Community
  • 1
  • 1
Ganesh G
  • 1,991
  • 1
  • 24
  • 37

3 Answers3

7

here are the points *if you want to make use of full height of the iPhone5 create splash screen that's exactly 640x1136 pixels in size and name default-568h@2x.png *if you have problem with rotation check a)window.rootViewController = firstViewcontroller (dont add view to your window) b)implement the new rorate delegate function

*Use viewDidLayoutSubviews rather than viewDidLoad to set up widget sizes relative to the window *You can manually check the screen size and load the right image like this:

    UIImage* myImage;
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
if ([UIScreen mainScreen].scale == 2.f && screenHeight == 568.0f) {
   myImage = [UIImage imageNamed:@"myImage-568h@2x.png"];
} else {
} 



myImage = [UIImage imageNamed:@"myImage.png"];

or use catogary from the following GIT gist https://gist.github.com/3719620

Hashim MH
  • 1,576
  • 1
  • 15
  • 29
4

Just use

CGRectGetHeight([UIScreen mainScreen].applicationFrame)
CGRectGetWidth([UIScreen mainScreen].applicationFrame)

to get screen's height & width.

Kjuly
  • 34,476
  • 22
  • 104
  • 118
  • Running in the simulator I get 320x480 even with iPhone Retina 4-inch selected. What's wrong there? I see the black borders on top and bottom. – fabb Sep 24 '12 at 10:00
  • 1
    Just provided new taller launch images and everything worked fine! – fabb Sep 24 '12 at 10:38
1

in your project (in XCode 4.5) goto "Supporting File" group (which is automatically created). you got to use those Default@2x.png/Default-568h@2x.png files. !!

That is the key change required for the OS to size the window to fill the iPhone 5 display. Redth# has posted a writeup on this and other size-related tweaks you might need to make.

!!

Community
  • 1
  • 1
Deepjyoti Roy
  • 482
  • 4
  • 15