From 5fb4887c6792af0777825c90bb06c3aac91b28c9 Mon Sep 17 00:00:00 2001 From: TrueZhuanjia Date: Tue, 14 Oct 2025 23:05:25 +0800 Subject: [PATCH] fixed: settings menu safeArea adaption some times not working on iPhone --- VoidLink/Base.lproj/iPad.storyboard | 10 +++++----- VoidLink/Base.lproj/iPhone.storyboard | 10 +++++----- VoidLink/ViewControllers/SettingsViewController.m | 13 +++++++++++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/VoidLink/Base.lproj/iPad.storyboard b/VoidLink/Base.lproj/iPad.storyboard index 7a139fc3..1f0a181e 100644 --- a/VoidLink/Base.lproj/iPad.storyboard +++ b/VoidLink/Base.lproj/iPad.storyboard @@ -963,7 +963,7 @@ - + @@ -1360,16 +1360,16 @@ - + - + @@ -1415,7 +1415,7 @@ - + diff --git a/VoidLink/Base.lproj/iPhone.storyboard b/VoidLink/Base.lproj/iPhone.storyboard index 0a296365..b0979abf 100644 --- a/VoidLink/Base.lproj/iPhone.storyboard +++ b/VoidLink/Base.lproj/iPhone.storyboard @@ -1306,7 +1306,7 @@ - + @@ -1754,16 +1754,16 @@ - + - + @@ -2197,7 +2197,7 @@ - + diff --git a/VoidLink/ViewControllers/SettingsViewController.m b/VoidLink/ViewControllers/SettingsViewController.m index 71056a9d..c5d4c415 100644 --- a/VoidLink/ViewControllers/SettingsViewController.m +++ b/VoidLink/ViewControllers/SettingsViewController.m @@ -402,7 +402,6 @@ BOOL isCustomResolution(int resolutionSelected) { [self.micHandler startTapping]; */ - [self updateParentStackHorizontalConstraints]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:) // handle orientation change since i made portrait mode available name:UIDeviceOrientationDidChangeNotification @@ -444,6 +443,9 @@ BOOL isCustomResolution(int resolutionSelected) { - (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:NO]; + + [self updateParentStackHorizontalConstraints]; + [self updateResolutionTable]; [self.customResolutionSwitch addTarget:self action:@selector(customResolutionSwitched:) forControlEvents:UIControlEventValueChanged]; @@ -532,7 +534,14 @@ BOOL isCustomResolution(int resolutionSelected) { if (@available(iOS 13.0, *)) { if(parentStackWidthConstraint && parentStackLeadingConstraint) [NSLayoutConstraint deactivateConstraints:@[parentStackLeadingConstraint, parentStackWidthConstraint]]; - UIInterfaceOrientation currentOrientation = keyWindow.windowScene.interfaceOrientation; + + UIWindowScene *activeScene = (UIWindowScene *)[UIApplication sharedApplication].connectedScenes.allObjects.firstObject; + UIInterfaceOrientation currentOrientation; + if (activeScene.activationState == UISceneActivationStateForegroundActive) { + currentOrientation = activeScene.interfaceOrientation; + } + else currentOrientation = keyWindow.windowScene.interfaceOrientation; + switch (currentOrientation) { case UIInterfaceOrientationLandscapeRight: parentStackLeadingConstraint = [_parentStack.leadingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor constant:0];