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;
}
}
Written by Sergi Gracia
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Xcode
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#