Should i have to place a separate xib Like 1 for iPhone5 and 1 for iPhone4 and lesser Doing this way seems very bad practice. Can any one have idea about it? Also iPhone5 Using Autolayout? i am not getting how Autolayout works.
5 Answers
Watch the WWDC 2012 Videos on the subject. There are three 1 hour videos that taught me all I needed to know in order to migrate my apps to Auto-Layout.

- 803
- 2
- 9
- 22
If your main issue is the new screen size make sure to add Default-568h@2x.png. This 640 × 1136 image is needed for your app to utilize the iPhone 5's full screen.
Also use
[[UIScreen mainScreen] applicationFrame]
to get the current screen's width and height. Do not hard code 320 width 480 height.
CGRect aFrame = [[UIScreen mainScreen] applicationFrame];
width=aFrame.size.width; height=aFrame.size.height;

- 101
- 1
- 5
-
This makes sense, but as I said above, don't you think apple will create something easier? – RayofHope Oct 22 '12 at 12:59
-
Easier? Thats easy enough Ray. Ray its always better to make your code smarter to overcome simple obstacles such as this. Don't depend on apple making it easier. Will appreciate a 1 or a check Ray. – Begeesy Oct 22 '12 at 20:22
seperate xib files: yes, is one of the possible ways.
autolayout: http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
(google first hit).

- 5,525
- 8
- 33
- 69
I modified my apps to include autolayout. In all honesty, if I'd have been more proactive I would have designed them with new screen sizes in mind at the start - a mistake I won't make again!
How you approach it really depends on how you designed your original application.

- 8,981
- 2
- 26
- 32
I found and will help others also: https://github.com/mindsnacks/UIImage-MSImageNamed568hSupport
using this we can load 568h size image for iPhone5 if present o.w. load normal image great help...
Example:
#import "UIImage+MSImageNamed568hSupport.h"
.
.
IBimgViewBG.image=[UIImage ms_imageNamed568hSupport:[NSString stringWithFormat:@"sample.png"]];
.
.
Note: include this images in your project
sample.png // for earlier versions
sample-568h.png // for iphone5

- 1,187
- 2
- 14
- 30
-
Dude, you are basically doing the same thing I showed you below. The first two lines of code are "const CGSize screenSize = [UIScreen mainScreen].bounds.size; const CGFloat screenHeight = MAX(screenSize.width, screenSize.height);" Could of gave me a 1 :( – Begeesy Oct 24 '12 at 19:58