iOS 14 settings menu UI bug fix

This commit is contained in:
TrueZhuanjia
2025-09-12 12:58:06 +08:00
parent 5318acc427
commit 3fcaafc42b
@@ -5,7 +5,6 @@
// Created by Diego Waxemberg on 10/27/14. // Created by Diego Waxemberg on 10/27/14.
// Copyright (c) 2014 Moonlight Stream. All rights reserved. // Copyright (c) 2014 Moonlight Stream. All rights reserved.
// //
// Modified by True砖家 since 2024.6.1
// Copyright © 2024 True砖家 @ Bilibili. All rights reserved. // Copyright © 2024 True砖家 @ Bilibili. All rights reserved.
// //
@@ -1205,7 +1204,9 @@ BOOL isCustomResolution(int resolutionSelected) {
// 旧版本iOS兼容必要 // 旧版本iOS兼容必要
- (void)forceRestoreHeightTemporarilyForSettingStackParentView{ - (void)forceRestoreHeightTemporarilyForSettingStackParentView{
for(UIStackView* stack in hiddenStacks) stack.hidden = NO; for(UIStackView* stack in hiddenStacks) {
stack.hidden = NO;
}
if(currentSettingsMenuMode == AllSettings){ if(currentSettingsMenuMode == AllSettings){
for(UIView* view in _parentStack.arrangedSubviews){ for(UIView* view in _parentStack.arrangedSubviews){
if([view isKindOfClass:[MenuSectionView class]]){ if([view isKindOfClass:[MenuSectionView class]]){
@@ -1239,6 +1240,18 @@ BOOL isCustomResolution(int resolutionSelected) {
for(NSString* settingIdentifier in _favoriteSettingStackIdentifiers){ for(NSString* settingIdentifier in _favoriteSettingStackIdentifiers){
[_parentStack addArrangedSubview:_settingStackDict[settingIdentifier]]; [_parentStack addArrangedSubview:_settingStackDict[settingIdentifier]];
} }
for(NSString* settingIdentifier in _favoriteSettingStackIdentifiers){
[_parentStack addArrangedSubview:_settingStackDict[settingIdentifier]];
}
// hidden Stacks that does not belong to favorite stacks shall also be added secretely to avoid stack restoring bug
for(UIStackView* stack in hiddenStacks){
if(![_favoriteSettingStackIdentifiers containsObject:stack.accessibilityIdentifier]){
[_parentStack addArrangedSubview:stack];
stack.hidden = YES;
}
}
[self hideDynamicLabelsWhenOverlapped:self.parentStack]; [self hideDynamicLabelsWhenOverlapped:self.parentStack];
[self layoutSettingsView]; [self layoutSettingsView];
} }
@@ -1995,16 +2008,19 @@ BOOL isCustomResolution(int resolutionSelected) {
if(hidden){ if(hidden){
stack.hidden = YES; stack.hidden = YES;
[self->hiddenStacks addObject:stack]; [self->hiddenStacks addObject:stack];
if(!settingsViewJustLoaded){
if([stack.superview.superview isKindOfClass:[MenuSectionView class]]){ if([stack.superview.superview isKindOfClass:[MenuSectionView class]]){
MenuSectionView* section = (MenuSectionView* )stack.superview.superview; MenuSectionView* section = (MenuSectionView* )stack.superview.superview;
if(!settingsViewJustLoaded) [section updateViewForFoldState]; [section updateViewForFoldState];
}
} }
} }
else{ else{
stack.hidden = NO; stack.hidden = NO;
if(!settingsViewJustLoaded){
if([stack.superview.superview isKindOfClass:[MenuSectionView class]]){ if([stack.superview.superview isKindOfClass:[MenuSectionView class]]){
MenuSectionView* section = (MenuSectionView* )stack.superview.superview; MenuSectionView* section = (MenuSectionView* )stack.superview.superview;
if(!settingsViewJustLoaded) [section updateViewForFoldState]; [section updateViewForFoldState];
} }
if([hiddenStacks containsObject:stack]){ if([hiddenStacks containsObject:stack]){
[self highlightedBackgroundForView:stack animateWithDuration:0.2]; [self highlightedBackgroundForView:stack animateWithDuration:0.2];
@@ -2013,6 +2029,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self clearBackgroundColorForView:stack animateWithDuration:0.2]; [self clearBackgroundColorForView:stack animateWithDuration:0.2];
}); });
} }
}
[hiddenStacks removeObject:stack]; [hiddenStacks removeObject:stack];
} }
} }