I want to show the Splash Screen in iPad application. Before that i want to get the current device orientation Landscape or Portrait mode. I have used,
UIInterfaceOrientation orientation= [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationLandscapeRight || orientation == UIInterfaceOrientationLandscapeLeft)
{
splachview=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)];
splachview.image=[UIImage imageNamed:@"Default-Landscape.png"];
splachview.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
splachview.contentMode = UIViewContentModeTop;
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
[self.window addSubview:splachview];
}
else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown)
{
splachview=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
splachview.image=[UIImage imageNamed:@"Default-Portrait.png"];
splachview.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
splachview.contentMode = UIViewContentModeTop;
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
[self.window addSubview:splachview];
}
in Appdelegate.m
. The UIInterface orienation always detecting in Portrait mode only. I launched the app in Landscape mode but, the control always detecting Portrait mode only. How can i get the current orientation in AppDelegate.m
? Please help me to find the solution. Thanks in advance.