TL;DR: The iOS docs disagree with Info.plist
about which orientation (landscape left vs. right) has the home button on which side. Am I missing something? (For example, there is a distinction between what orientation the code thinks it is in, and the orientation the device knows it is in. See next-to-last bullet point labeled ❓ below.)
The doc for UIDeviceOrientation
says
However, when I use the General checkbox in Xcode, the Info.plist
file says the opposite:
The above info presents the contradiction clearly enough. My question is: am I missing something or should I just take this as long-lasting cruft in the toolchain/docs/API?
What actually happens when the app runs on the Simulator or devices, you ask? The following is a subset of the data I have collected. For your reading convenience, I have emphasized the terms LEFT and RIGHT. Your brain may still explode.
There are three quantities to track:
UIDevice.current.orientation
says.When the General checkbox is set solely to "Landscape LEFT":
Info.plist
file says "Landscape (LEFT home button)" [i.e. disagrees with documentation]UIDevice.current.orientation == .landscapeRIGHT
[i.e. disagrees with Xcode, but agrees with Simulator menu]UIDevice.current.orientation == .landscapeLEFT
[consistent with docs/contrary to Xcode/plist]UIDevice.current.orientation == .landscapeRIGHT
[consistent with docs/contrary to Xcode/plist]UIDevice.current.orientation == .landscapeRIGHT
[i.e. it's consistent with what the app thinks is going on, not with the physical orientation of the device]I think mainly it's a matter of a contradiction between Xcode UI and info.plist. Xcode UI shows "Device Orientation", while info.plist speaks about "Supported Interface Orientation". But as we know those two are different things, so there's definitely something wrong there.
Assuming, between the two, that info.plist wins then those fields (for iPhone and iPad) are used to specify Supported Interface Orientation. I.e. the same option that you can also override in a specific view-controller through supportedInterfaceOrientations
.
Instead the referenced doc page is about Device Orientation, with its own definition of what is landscapeLeft: home button to the right.
Now, looking at Interface Orientation Mask docs, there's no real detail on what is landscapeLeft, but old Xcode UI screenshots show that home button is to the left. See e.g. from this SO thread:
EDIT: Interface Orientation doc page instead has detail on what is landscapeLeft: home button to the left, as shown in old screenshots.
Conclusions
So, all in all, it seems to me that:
Xcode UI/info.plist are about supported interface orientation, which has its own definition of landscape left/right
Device orientation has the opposite definition of landscape left/right
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With