Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
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.
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.
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.