views:

744

answers:

1

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.

+1  A: 

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.

Tim
I am reading it correctly. I rotate the device clockwise and get UIInterfaceOrientationLandscapeLeft :/
Jaka Jančar
What SDK version are you using?
Tim
3.0 on Snow Leopard.
Jaka Jančar
Happens in both the simulator and on an iPhone, btw.
Jaka Jančar
Same happens if I paste the above code in RootViewController.m of the default Navigation-based app template.
Jaka Jančar
Hm. Is it possible for you to update to 3.1 on Snow Leopard? I'm in the process of doing so right now - if you can't, I'll be able to tell you in about a half hour whether this is an issue in 3.1.
Tim
OK, I've successfully reproduced your issue in Xcode 3.2/iPhone OS 3.1 GM on Snow Leopard. I've confirmed it in the docs, too. You may want to file a bug with Apple (and possibly post it on OpenRadar as well so other developers can follow the bug).
Tim
Done! Thanks for confirming I haven't gone mad :)
Jaka Jančar