In iOS16 beta7, I found an issue where changing the interface orientation in unwind segue back from a child ViewController causes inconsistencies between the on-screen appearance and the internal behavior.
viewWillTransitionToSize is not called.
windowScene.interfaceOrientation is not updated
I have a UIKit based app and it works fine up to iOS15.
- It has a ViewController (VC1) that has a settings screen as a child ViewController (VC2).
- The screen orientation of VC1 is fixed to either portrait or landscapeR according to the mode set in VC2.
- In order to reflect the mode change in VC2, the return value of VC1's supportedInterfaceOrientations is changed according to the mode in the unwind segue from VC2 back to VC1.
In iOS16, I noticed that after setting supportedInterfaceOrientations to one direction only, the changes are no longer reflected because supportedInterfaceOrientations is no longer called.
So I added a call of setNeedsUpdateOfSupportedInterfaceOrientations, which improved many situations.
So now the process in the unwind segue from VC2 back to VC1 is as follows
- Change the return value of supportOfSupportedInterfaceOrientations according to the mode setting
- And if iOS>=16.0 , call setNeedsUpdateOfSupportedInterfaceOrientations.
With iOS15 there is no problem.
【Appearance】 When going back from VC2 to VC1, VC1 is shown in the changed orientation from the beginning. The transition animation is also presented in the changed orientation.
【Internal state】 viewWillTransitionToSize is called before viewWillAppear in VC1 to get the size after the orientation change. And the correct orientation can be obtained by self.view.window.windowScene.interfaceOrientation after viewWillLayoutSubviews.
However, the following problems are currently occurring in iOS16 beta7.
【Appearance】 When going back from VC2 to VC1, VC1 is shown in the changed orientation from the beginning. The transition animation is also presented in the changed orientation. But, the displayed contents are broken.
【Internal state】 (1) viewWillTransitionToSize in VC1 is not called at all. And (2) self.view.window.windowScene.interfaceOrientation is not updated at all and remains at the old value.
→ Therefore, (1) view size cannot be updated and does not match the actual screen, and (2) the interface orientation obtained in (2) is also old and does not match the actual screen.
→ As a result, the screen adjusted and drawn based on (1) and (2) will be broken.
I think this is a bug in IOS16 beta.
It's not a spec change, is it?
Does anyone have any information on this issue?
Post
Replies
Boosts
Views
Activity
When I run my iPhone-portrait-only app on iPadOS15 and turn the iPad to landscape, the iPad screen rotates and the portrait iPhone app appears inside the landscape iPad screen.
This causes the orientation of the device and the app to be misaligned, resulting in a 90-degree shift in the orientation of the acceleration acquired by CMDeviceMotion. Tested on iPad6/iPadOS15.5.
Is there a way to obtain the correct acceleration for the iPhone-only app on iPad?
(other than locking the iPad screen rotation by user)