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,23 +2008,27 @@ BOOL isCustomResolution(int resolutionSelected) {
if(hidden){ if(hidden){
stack.hidden = YES; stack.hidden = YES;
[self->hiddenStacks addObject:stack]; [self->hiddenStacks addObject:stack];
if([stack.superview.superview isKindOfClass:[MenuSectionView class]]){ if(!settingsViewJustLoaded){
MenuSectionView* section = (MenuSectionView* )stack.superview.superview; if([stack.superview.superview isKindOfClass:[MenuSectionView class]]){
if(!settingsViewJustLoaded) [section updateViewForFoldState]; MenuSectionView* section = (MenuSectionView* )stack.superview.superview;
[section updateViewForFoldState];
}
} }
} }
else{ else{
stack.hidden = NO; stack.hidden = NO;
if([stack.superview.superview isKindOfClass:[MenuSectionView class]]){ if(!settingsViewJustLoaded){
MenuSectionView* section = (MenuSectionView* )stack.superview.superview; if([stack.superview.superview isKindOfClass:[MenuSectionView class]]){
if(!settingsViewJustLoaded) [section updateViewForFoldState]; MenuSectionView* section = (MenuSectionView* )stack.superview.superview;
} [section updateViewForFoldState];
if([hiddenStacks containsObject:stack]){ }
[self highlightedBackgroundForView:stack animateWithDuration:0.2]; if([hiddenStacks containsObject:stack]){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), [self highlightedBackgroundForView:stack animateWithDuration:0.2];
dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)),
[self clearBackgroundColorForView:stack animateWithDuration:0.2]; dispatch_get_main_queue(), ^{
}); [self clearBackgroundColorForView:stack animateWithDuration:0.2];
});
}
} }
[hiddenStacks removeObject:stack]; [hiddenStacks removeObject:stack];
} }