I have an app with a tab bar, and nav controllers in each tab. When user shakes the device, a UIImageView appears as a child view in the nav controller. But the
Getting the current orientation
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationLandscapeLeft) {
NSLog(@"Landscape left");
self.lblInfo.text = @"Landscape left";
} else if (orientation == UIInterfaceOrientationLandscapeRight) {
NSLog(@"Landscape right");
self.lblInfo.text = @"Landscape right";
} else if (orientation == UIInterfaceOrientationPortrait) {
NSLog(@"Portrait");
self.lblInfo.text = @"Portrait";
} else if (orientation == UIInterfaceOrientationPortraitUpsideDown) {
NSLog(@"Upside down");
self.lblInfo.text = @"Upside down";
}
}