Last Updated: February 25, 2016
·
2.709K
· sergigracia

Get current device orientation

Landscape

//Return YES if current orientation is landscape
+ (BOOL) isOrientationLandscape
{    
    if (UIDeviceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])){
        return YES;
    }else{
        return NO;
    }    
}

Portrait

//Return YES if current orientation is portrait 
+ (BOOL) isOrientationPortrait 
{    
    if (UIDeviceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])){
        return YES;
    }else{
        return NO;
    }    
}