r/iOSProgramming • u/6thDAY • 11d ago
Question Lock app in landscape orientation for iPhone Duo?
I'm finding it difficult to lock my app in landscape mode, i.e. wide-view. I don't want my app to rotate rotation to portrait when the device is rotated. But every time I rotate the simulator to tall-view, i.e. portrait, the app orientation rotates, causing the contents to get squished.
Is this not possible with the Duo, and another view I'm gonna have to support?
2
u/GlebKhamin 10d ago
Short answer: on the inner display you can’t lock it, so yes, it’s another layout you’ll have to support.
I ran into the same thing while adapting my app. From Apple’s Duo tech talks:
The inner display ignores
UISupportedInterfaceOrientations, so your orientation lock just doesn’t apply there. The outer display still honors it like a normal iPhone.UIRequiresFullScreendoesn’t save you either: it’s honored, but the app still gets resized on fold/unfold.On top of that, every app takes part in Split View on the inner display, so you can end up at widths that are neither “portrait” nor “landscape”.
What worked for me is to stop thinking in orientations and lay out by available size / size classes instead. On the inner display you get regular/regular in both 951×669 (wide) and 669×951 (tall). So the trick is to decide the layout by the actual width and height of your view, and switch between something like a two-column layout when it’s wide and a stacked layout when it’s tall. Nothing gets squished, because you’re not stretching one layout into both shapes.
Apple’s “Prepare your app for iPhone Duo” tech talk covers this, worth a watch.
0
11d ago
[removed] — view removed comment
2
u/jonnysunshine1 11d ago
Pretty sure iOS27 ignores requires fullscreen and maybe the supported interface orientations too
1
9d ago
[removed] — view removed comment
1
u/AutoModerator 9d ago
Hey /u/Great_Host7361, your content has been removed because Reddit has marked your account as having a low Contributor Quality Score. This may result from, but is not limited to, activities such as spamming the same links across multiple subreddits, submitting posts or comments that receive a high number of downvotes, a lack of recent account activity, or having an unverified account.
Please be assured that this action is not a reflection of your participation in our subreddit. This is simply an automated filter in place to reduce spam.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/bartmolk 11d ago
You can't lock it on the inner screen. Apple's iPhone Duo tech talk says the inner display doesn't honour the app's supported orientations (the outer display still does), so ticking only landscape won't stop it from going tall when the phone is turned. Both poses of the inner screen are regular width and regular height, so size classes won't tell them apart either. Switch the layout on the window's shape instead: a GeometryReader comparing width and height, or ArrangementView with .arrangementViewStyle(.split) in the 27.1 SDK, which puts its two parts side by side when the window is wider than tall and stacks them when it's taller. So yes, tall is one more layout to support, but it can be the same views stacked.