1
votes

In Xcode in Device orientation section only "Portrait" is selected. On iPhone it works properly, when phone rotated to landscape mode it still works as portrait, so no changing. But on iPad (6th generation) when display is rotated to landscape mode actual screen in my app is also rotated, but without autoscaling. But I don't want that it will be possible to rotate screen on iPad. Do I need to fix it by code or some other settings on Xcode besides "Device Orientation" settings

portrait

Landscape

1
Upvoted. This is something I've never seen. I have apps the require a different layout depending on the device rotation, and I've coded some that use the camera the require fixed orientation. But in the case of the latter, I never actually tried things on an iPad! My best guess? It gets down to size classes. Until iPadOS 14 I never understood why Apple made all orientations on the iPad be "regular". But I do now - sometimes in split screen it isn't - it's compact. Digging deeper, it kind of makes sense that Apple feels the "iPad experience" should rotate to the device orientation.... - dfd
2/ I have code that probably won't help, but I'll offer it. Picture an app with a UIImageView and 4 sliders. With a desire to emphasize the image, the sliders are either below or to the right of the image, depending on the orientation. Where I don't think this will help you is the the sliders do rotate and are horizontal always. But maybe this could give you a ways to build an orientation-based UI. One thing - you simply cannot accomplish this in a Storyboard. You need to activate/deactivate your constraints in code, after intercepting when the orientation changes. - dfd
I have my sliders inside the app, to give to user bigger image on the output. Anyway... as I understand I can't prevent this rotation on iPad, correct? - Artem
Not that I can tell. (But again, I've only tried to prevent landscape orientation on an iPhone and was surprised to see it doesn't work on an iPad, thus the upvote.) In my apps I' doing the opposite - laying things out differently depending on if it's portrait or landscape using auto layout. While Apple recommends checking the trait collection, on iPads it only becomes compact size in certain split screen layouts. - dfd

1 Answers

1
votes

So in the info.plist for your app you just gotta go to "Supported interface orientation (iPad)" open that section up with the disclosure triangle and delete the items you don't want to rotate to for the iPad!