Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight are reversed?

The documentation says:

UIInterfaceOrientationLandscapeLeft

The device is in landscape mode, with the device held upright and the home button on the right side.

UIInterfaceOrientationLandscapeRight

The device is in landscape mode, with the device held upright and the home button on the left side.

However, I'm getting them exactly reversed. Can there really be such a mistake in the SDK, or am I just going crazy?

Code:

+ (NSString *)NSStringFromUIInterfaceOrientation:(UIInterfaceOrientation)o
{
    switch (o) {
        case UIInterfaceOrientationPortrait: return @"UIInterfaceOrientationPortrait";
        case UIInterfaceOrientationPortraitUpsideDown: return @"UIInterfaceOrientationPortraitUpsideDown";
        case UIInterfaceOrientationLandscapeLeft: return @"UIInterfaceOrientationLandscapeLeft";
        case UIInterfaceOrientationLandscapeRight: return @"UIInterfaceOrientationLandscapeRight";
    }
    return nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    NSLog(@"Should: %@", [[self class] NSStringFromUIInterfaceOrientation:toInterfaceOrientation]);
    return YES;
}    

I paste the above code in RootViewController.m of the default Navigation-based app template.

Follow-up: Reported as bug 7216046.

like image 856
Jaka Jančar Avatar asked Nov 14 '22 14:11

Jaka Jančar


1 Answers

Are you sure you're reading the docs correctly? Notice that the home button position and the orientation value are opposites - that is, UIInterfaceOrientationLandscapeLeft implies the home button on the right side, and UIInterfaceOrientationLandscapeRight implies the home button on the left side. Make sure you're rotating your device to check properly.

Edit: I've confirmed the issue presented in the original question. Looks like a bug, unless I'm missing something too.

like image 127
Tim Avatar answered Jan 01 '23 07:01

Tim