Since i want the app to run in both ios 5 as well as in ios 6 ,I am trying to run the app in ios 5 which is working perfectly in ios 6 as i have used the autolayout feature but when i use to run the app in ios 5 it crashes since autolayout feature is not available in previous versions of ios .Is there any solution to fix out my problem ? Answer will be appreciated.
-
1just uncheck that use autolayout. – Manu Mar 12 '13 at 06:52
-
http://stackoverflow.com/questions/12411980/enabling-auto-layout-in-ios-6-while-remaining-backwards-compatible-with-ios-5 See this link about auto layout in ios6 and ios5 compatibility. – Cintu Mar 12 '13 at 06:56
4 Answers
If you want to run your app in iOS 5 then you have to turn off the Autolayout feature. You can do that from Interface builder.
For more help you can refer this.

- 1,799
- 1
- 11
- 29
-
Thanx for the answer,but if i will uncheck the autolayout in the interface builder app wo'nt work properly in ios 6. – Tanya Prashar Mar 12 '13 at 06:54
-
Is there any link available for manually enabling the autolayout feature ? – Tanya Prashar Mar 12 '13 at 07:18
-
for iOS 5 you can not use autolayout. You should use autoresizing masks. as you can see in the answer by 'AppleDelegate', change the resizing rules with those red lines. Its also works best when you set 'none' for top bar and bottom bar under simulated metrics (of interface builder->attributes inspector) and also set status bar to 'default'. – Rukshan Mar 12 '13 at 09:39
-
-
@user1999748 if this answer is helpful to you then please accept the answer so it will also help to other user also.Thanks. – Yashesh Mar 19 '13 at 13:08
- You Need to unCheck the Auto Layout.
- And make sure you are changing here also.. select ios 5.1

- 4,730
- 2
- 20
- 45
You have to use
AutoResizing
mask for your view instead of autolayouts
since autolayouts are supported iOS 6 onwards.Check the example below

- 4,269
- 1
- 20
- 27
-
Is not possible to disable autolayout programatically for ios versions lower than ios 6 ? – Tanya Prashar Mar 12 '13 at 07:12
-
Best current practice would be to use autoresizing and disable autolayout from the storyBoard nibs.Autoresizing shall work perfect for all iPhone screens – AppleDelegate Mar 12 '13 at 08:57
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 Default-568h@2x.png.

- 7,222
- 2
- 31
- 52