Reputation: 311
I have set the Device Orientation to have only 'Portrait' checked in Xcode. However when I run my app in the simulator, it rotates in all orientations.
Showing correctly in Portrait (intended) and Landscape (not intended)
Anyone faced same issue before? Thanks
Upvotes: 31
Views: 11624
Reputation: 1098
Maybe Xcode 14 fixed the bug, now it is kind to config device orientation on iPhone and iPad:
Upvotes: 1
Reputation: 1098
In my case (Xcode 13.1),It works perfectly for me:
Follow steps:
Build Settings
;All
and Combined
options;orientation
keywordsSupported interface Orientations(iPhone)
, click the value of it on the right;Upvotes: 50
Reputation: 116
I have the same problem and costed my entire day onto it, i resolved by doing this: override the AppDelegate method
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
if self.allowOrentitaionRotation {
return .allButUpsideDown;
}
return .portrait;
}
Upvotes: 2
Reputation: 22763
The "General"->"Deployment Info" UI in Xcode can be deceiving. Check these two keys in your info.plist
:
UISupportedInterfaceOrientations
and
UISupportedInterfaceOrientations~ipad
Upvotes: 22
Reputation: 51
I have had the same problem (in physical devices). on iPhone it works fine but on iPad it does not work. The solution was to adjust the option of "devices" for both, in this case "landscape right".
Upvotes: 5