i am developing an application which would work on iphone 4s and iphone 5,the main theme here is designing screens for both iphone 4s and iphone 5,In my previos application i have used two different storyboards for both the devices using -(void)initializeStoryBoardBasedOnScreenSize
iOSDeviceScreenSize.height. But in my new application i want to do it through xibs not using storyboards, So i want solution how i can develop an app which is compatible for the all the devices screen wise, please spend your valuable time on this question to update my knowledge, Thank you so much in advance..
Asked
Active
Viewed 735 times
0

JiteshW
- 2,195
- 4
- 32
- 61

SadikHasan
- 1
- 1
3 Answers
0
you are do by many way
1) use autolayout for compatible for iphone 4s and iphone 5.
See http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
2) get screensize and setFrame according to device
#define IS_HEIGHT_GTE_568 [[UIScreen mainScreen ] bounds].size.height >= 568.0f
if( IS_HEIGHT_GTE_568)
{
// code for iPhone 5
}else
{
// code for iPhone 4s
}
3) get screensize and load Nib according to device
#define IS_HEIGHT_GTE_568 [[UIScreen mainScreen ] bounds].size.height >= 568.0f
if( IS_HEIGHT_GTE_568)
{ // Nib for iPhone5
}else
{
// Nib for iPhone 4s
}

Sumit Mundra
- 3,891
- 16
- 29
-
Hi sumit,thanks for the answer,Where do i need to write this code?and Do i need to write this code every time when i make action which will get another screen?i hope you understand my Question? – SadikHasan May 08 '13 at 09:28
-
#define IS_HEIGHT_GTE_568 [[UIScreen mainScreen ] bounds].size.height >= 568.0f put this code in your .Pch file and when you need then check in your if condition that device is iPhone 4 or iPhone 5 – Sumit Mundra May 08 '13 at 09:32
-
and if you load differnt xib for iPhone4 and iPhone 5 then usehomePageVC = [[HomePageViewController alloc]initWithNibName:IS_HEIGHT_GTE_568 ? @"HomePageViewController_iPhon5":@"HomePageViewController_iPhone4" bundle:[NSBundle mainBundle]]; – Sumit Mundra May 08 '13 at 09:36
-
Once again thanks for that,Can't we use autolayout?is there any disadvantage by using auto layout? – SadikHasan May 08 '13 at 09:36
-
if you develop apps only ios6 then use autolayout bCoz autolayout is available in ios6 otherwise you use resizing and setframe or loadxib by code – Sumit Mundra May 08 '13 at 09:39
0
There are two way you can use 1-create two xib and load required according to screen size.
2-use autolayout feature.
You can follow these tutorial.
How to develop or migrate apps for iPhone 5 screen resolution?

Community
- 1
- 1

Suraj Gupta
- 200
- 9