mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-09 03:10:22 +00:00
IOS7: Fix show/hide of virtual controller in iOS 15
The change in commit 1b3c783b9e
assumed
that the orientation already had been updated when the system called
viewWillTransitionToSize. This seems to be true for iOS 16 while in
iOS 15 the orientation seems to be updated a bit later.
In iOS 16, make sure that the current orientation is updated when the
function viewWillTransitionToSize is called to make sure it's updated
when the adjustViewFrameForSafeArea is called. This makes sure that the
screen size is updated correctly when forcing the orientation based on
the backend user setting.
In iOS 15 (and below), set the current orientation when the transition
animation finishes to make sure that the interface orientation has been
updated to make sure the virtual controller is connected/disconnected
properly based on the orientation.
This commit is contained in:
parent
e1483c36a3
commit
9a980c9dd4
@ -88,11 +88,26 @@
|
||||
|
||||
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
|
||||
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
||||
|
||||
// In iOS 16, make sure that the current orientation is updated when the
|
||||
// function viewWillTransitionToSize is called to make sure it's updated
|
||||
// when the adjustViewFrameForSafeArea is called. This makes sure that the
|
||||
// screen size is updated correctly when forcing the orientation based on
|
||||
// the backend user setting.
|
||||
UIInterfaceOrientation orientationAfter = [self interfaceOrientation];
|
||||
if (orientationAfter != UIInterfaceOrientationUnknown && orientationAfter != currentOrientation) {
|
||||
currentOrientation = orientationAfter;
|
||||
[[iOS7AppDelegate iPhoneView] interfaceOrientationChanged:currentOrientation];
|
||||
if (orientationAfter != UIInterfaceOrientationUnknown) {
|
||||
[self setCurrentOrientation:orientationAfter];
|
||||
}
|
||||
// In iOS 15 (and below), set the current orientation when the transition
|
||||
// animation finishes to make sure that the interface orientation has been
|
||||
// updated to make sure the virtual controller is connected/disconnected
|
||||
// properly based on the orientation.
|
||||
[coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
|
||||
UIInterfaceOrientation orientationAfter = [self interfaceOrientation];
|
||||
if (orientationAfter != UIInterfaceOrientationUnknown) {
|
||||
[self setCurrentOrientation:orientationAfter];
|
||||
}
|
||||
}];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user