-6

My App is working fine in iphone 4, but in iphone 5 it is showing the bottom screen empty. And i think it is because iphone 5 has larger screen, so what is the solution to it, how to manage that extra space. Please guide for the above.

Thanks in advance.

1

6 Answers 6

3

Use this code it will help you, here we have to create two xib file for using this code like (viewcontroller.xib and viewcontroller_5.xib),when you use the application in iphone4 call iphone4 screen else call iphone5 screen.

Thanks.

if([[UIScreen mainScreen] bounds].size.height == 568){
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_5" bundle:nil] autorelease];

   NSLog(@"iphone5");
}else
{
  self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    NSLog(@"iphone4");
}
2

See following links it will solve every your doubts, 1)How to develop or migrate apps for iPhone 5 screen resolution?

2)iOS 6 apps - how to deal with iPhone 5 screen size?

3)iOS 6 - Distinguishing between iPhone 5 and other devices?

4)How to detect iPhone 5 (widescreen devices)?

2

If you are using iOS 6 or later , then u can create a separate xib for the iphone 5 called Retina 4 Full screen. You need to check this in your ViewController Size. Also to check for for both of these xib's . That means to run either of your xib's in iphone 5 or lower versions use these conditions whether in the AppDelegate or wherever you need to show another ViewController.

CGSize result = [[UIScreen mainScreen] bounds].size;
if(result.height == 480)
{
}
else if(result.height == 568)
{
}

the above code would check for the size of your iphone's screen and accordingly adjust. Hope this has cleared your issues :).

PS:- Dont forget to add your iphone 5 splash screen i.e [email protected].

1

According to me the best way of dealing with such problems and avoiding couple of condition required for checking the the height of device, is using the relative frame for views or any UI element which you are adding to you view for example: if you are adding some UI element which you want should at the bottom of view or just above tab bar then you should take the y origin with respect to your view's height or with respect to tab bar (if present). For such cases where you are putting images as background for full view then you can set the Image as the background colour for the view.

self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @"IMAGE TO BE ADDED"]];

0

Try this for any controller,

enter image description here

So, it'll automatically resize window according to height.

For, retina(iPhone-5) display, you must import "[email protected]" file in your xcode project.

Hopefully, it'll help you to understand.
Thanks.

0

Add the same splash screen image as used for devices below iPhone 5 but with image size 960 * 1136 and the name as [email protected] i.e if Default.png is currently the splash screen. This shall provide iPhone 5 screen support to your application.

1
  • He is not talking about splash screen!
    – DD_
    Mar 11, 2013 at 11:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.