0
(BOOL)isSupportAutoLayOut
{
    int version = [[[UIDevice currentDevice].systemVersion substringToIndex:1] intValue];
    if(version == 6)
    {
       return YES;
    }
    return NO;
 }

I want to support iOS 5 and iOS 6 system, on iPhone and iPad.

Does it have bug?

Bijoy Thangaraj
  • 5,434
  • 4
  • 43
  • 70
user1292717
  • 173
  • 10
  • See http://stackoverflow.com/a/7848772/1271826 for determining iOS version. And, BTW, if you were checking for iOS versions, you want to check for iOS greater than or equal to 6.0 or less than 6.0, _not_ equal to 6.0. But the correct solution is that if your app is supporting iOS versions earlier than 6.0, then turn off auto layout altogether. – Rob Dec 13 '12 at 07:40

2 Answers2

1

use it like this

-(BOOL)isSupportAutoLayOut
{
    float version = [[[UIDevice currentDevice].systemVersion] floatValue];
    if(version >= 6.0)
    {
       return YES;
    }
    return NO;
}
Talha
  • 809
  • 4
  • 13
0

If you need to deploy for iOS 5, you cannot use Autolayout. If you do, you'll get an exception saying device that doesn't support the new NSLayoutConstraint class in OS versions before iOS 6.

There is no way to support autolayout conditionally like you are asking.

However, it may be is possible to load from the code, a different storyboard or nib (.xib) file that is built using autolayout based on the conditional check for iOS 6 (someone has to confirm this I tried it, its working).

Bijoy Thangaraj
  • 5,434
  • 4
  • 43
  • 70