I have an iOS app for an iPhone that displays information on the screen. The Deployment Info indicates that LandscapeLeft and LandscapeRight are supported.
When I start my app with the device in LandscapeRight, then everything is fine and turning my device to LandscapeLeft reverts my whole image by 180 degrees and the displayed information are still ok.
Now if I start the application with my device turning in LandscapeLeft, the the application will anyway start in Landscape Right and I have to do a full physical turn of my device to have the right orientation detected.
Basically if I add the code at the beginning of my ViewController viewDidLoad:
if ([UIApplication sharedApplication].statusBarOrientation == UIDeviceOrientationLandscapeLeft)
{
NSLog(@"LandscapeLeft");
}
else if ([UIApplication sharedApplication].statusBarOrientation == UIDeviceOrientationLandscapeRight)
{
NSLog(@"LandscapeRight");
}
always displays LandscapeRight.
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration
is not called if my device orientation does not change physically. Any suggestion how I can detect the real orientation ? Thanks.
=== EDIT ===
I just found out something interesting. If I keep the Launchscreen in the .plist file (I removed it) and related default Launchscreen.xib, then it works fine. How can I properly have ;y desired behaviour without launch screen ?