Bug 59554 - Mixed-up landscape orientations
Summary: Mixed-up landscape orientations
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 10.99 (xcode9)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2017-09-18 12:20 UTC by Xavier P
Modified: 2017-09-19 12:02 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Example application used to explain the values. (39.23 KB, application/zip)
2017-09-19 11:26 UTC, Manuel de la Peña [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Xavier P 2017-09-18 12:20:32 UTC
When simulating an application, the simulator menu allows to change the orientation to be:

- Landscape Right (Home button on the LEFT)
- Landscape Left (Home button on the RIGHT)

(as described on https://developer.apple.com/documentation/uikit/uiinterfaceorientation)

When calling UIApplication.SharedApplication.StatusBarOrientation, the orientation is Landscape RIGHT when actually in Landscape LEFT, and similarly, Landscape LEFT when actually in Landscape RIGHT.

This has been reproduced with following simulators:

- iPhone X (iOS 11)
- iPhone 8 (iOS 11)
- iPhone 7 (iOS 11)
- iPhone 7 (iOS 10.3.1)
- iPhone 6s (iOS 11)

Since it happens for iOS 10.3.1 as well, it is not related to iOS 11.

When I debug on my physical device iPhone 6s running iOS 11 GM, I get the same mix-up landscape orientation, so the problem is actually not bound to the iOS simulators.
Comment 1 Manuel de la Peña [MSFT] 2017-09-19 11:26:40 UTC
Created attachment 24808 [details]
Example application used to explain the values.


First we need to understand what is the actual problem. There are two different ways to get the orientation:

- Device orientation
    Is the current orientation of the device itself, not of the user 
    interface currently displayed within the device. 

- Interface orientation
    Is the current orientation of the target interface. 

If you take a look at apples documentation:

"Notice that UIDeviceOrientationLandscapeRight is assigned to UIInterfaceOrientationLandscapeLeft and UIDeviceOrientationLandscapeLeft is assigned to UIInterfaceOrientationLandscapeRight; the reason for this is that rotating the device requires rotating the content in the opposite direction."


So, If you look at the attached application, you will see that the values are correctly returned.
Comment 2 Xavier P 2017-09-19 12:02:23 UTC
Oh... you're right! I did not know about UIDevice.CurrentDevice.Orientation. Only found references to UIApplication.SharedApplication.StatusBarOrientation. That solves the problem then.

Thanks for the sample application which makes it crystal clear.