user1292717
user1292717

Reputation: 173

Is it ok the below method to decide to use auto layout?

(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?

Upvotes: 0

Views: 102

Answers (2)

Bijoy Thangaraj
Bijoy Thangaraj

Reputation: 5546

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).

Upvotes: 0

Talha
Talha

Reputation: 809

use it like this

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

Upvotes: 1

Related Questions