IOS7: Fix orientation detection when the view becomes visible

This commit is contained in:
Thierry Crozat 2023-04-27 00:22:44 +01:00
parent e8d87fb92a
commit c9b8bf2ca1

View File

@ -57,14 +57,16 @@
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
UIInterfaceOrientation orientationBefore = UIInterfaceOrientationUnknown;
UIInterfaceOrientation orientation = UIInterfaceOrientationUnknown;
if (@available(iOS 13.0, *)) {
orientationBefore = [[[[self view] window] windowScene] interfaceOrientation];
orientation = [[[[self view] window] windowScene] interfaceOrientation];
} else {
orientationBefore = [[UIApplication sharedApplication] statusBarOrientation];
orientation = [[UIApplication sharedApplication] statusBarOrientation];
}
if (orientation != UIInterfaceOrientationUnknown && orientation != currentOrientation) {
currentOrientation = orientation;
[[iOS7AppDelegate iPhoneView] interfaceOrientationChanged:orientation];
}
if (currentOrientation != UIInterfaceOrientationUnknown)
[[iOS7AppDelegate iPhoneView] interfaceOrientationChanged:currentOrientation];
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {