favorite section offset

This commit is contained in:
TrueZhuanjia committed 2025-06-14 19:48:33 +08:00
1 parent ed0045afec
commit 758a888a53
1 file changed
+8 -6
@@ -377,7 +377,7 @@ BOOL isCustomResolution(CGSize res) {
_parentStack.translatesAutoresizingMaskIntoConstraints = NO; _parentStack.translatesAutoresizingMaskIntoConstraints = NO;
[self.scrollView addSubview:_parentStack]; [self.scrollView addSubview:_parentStack];
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
[_parentStack.topAnchor constraintEqualToAnchor:self.scrollView.contentLayoutGuide.topAnchor constant: [self getStandardNavBarHeight]], [_parentStack.topAnchor constraintEqualToAnchor:self.scrollView.contentLayoutGuide.topAnchor constant: currentSettingsMenuMode == AllSettings ? [self getStandardNavBarHeight] : [self getStandardNavBarHeight]+20],
[_parentStack.bottomAnchor constraintEqualToAnchor:self.scrollView.contentLayoutGuide.bottomAnchor constant:-20], [_parentStack.bottomAnchor constraintEqualToAnchor:self.scrollView.contentLayoutGuide.bottomAnchor constant:-20],
[_parentStack.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor constant: 0], //mark: settingMenuLayout [_parentStack.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor constant: 0], //mark: settingMenuLayout
[_parentStack.widthAnchor constraintEqualToAnchor:self.view.widthAnchor constant:-20] // section width adjusted here //mark: settingMenuLayout [_parentStack.widthAnchor constraintEqualToAnchor:self.view.widthAnchor constant:-20] // section width adjusted here //mark: settingMenuLayout
@@ -1013,17 +1013,19 @@ BOOL isCustomResolution(CGSize res) {
} }
- (void)switchToFavoriteSettings{ - (void)switchToFavoriteSettings{
[self updateTheme]; for(UIView* view in _parentStack.subviews){
[view removeFromSuperview];
}
currentSettingsMenuMode = FavoriteSettings; currentSettingsMenuMode = FavoriteSettings;
[self initParentStack];
[self updateTheme];
DataManager* dataMan = [[DataManager alloc] init]; DataManager* dataMan = [[DataManager alloc] init];
Settings *currentSettings = [dataMan retrieveSettings]; Settings *currentSettings = [dataMan retrieveSettings];
currentSettings.settingsMenuMode = [NSNumber numberWithInteger:currentSettingsMenuMode]; currentSettings.settingsMenuMode = [NSNumber numberWithInteger:currentSettingsMenuMode];
[dataMan saveData]; [dataMan saveData];
for(UIView* view in _parentStack.subviews){
[view removeFromSuperview];
}
_parentStack.spacing = 15; _parentStack.spacing = 15;
[self loadFavoriteSettingStackIdentifiers]; [self loadFavoriteSettingStackIdentifiers];
for(NSString* settingIdentifier in _favoriteSettingStackIdentifiers){ for(NSString* settingIdentifier in _favoriteSettingStackIdentifiers){
[_parentStack addArrangedSubview:_settingStackDict[settingIdentifier]]; [_parentStack addArrangedSubview:_settingStackDict[settingIdentifier]];
@@ -1032,6 +1034,7 @@ BOOL isCustomResolution(CGSize res) {
} }
- (void)switchToAllSettings{ - (void)switchToAllSettings{
currentSettingsMenuMode = AllSettings;
for(UIView* view in _parentStack.subviews){ for(UIView* view in _parentStack.subviews){
[view removeFromSuperview]; [view removeFromSuperview];
} }
@@ -1039,7 +1042,6 @@ BOOL isCustomResolution(CGSize res) {
[self layoutSections]; [self layoutSections];
[self updateTheme]; [self updateTheme];
//[self doneRemoveSettingItem]; //[self doneRemoveSettingItem];
currentSettingsMenuMode = AllSettings;
DataManager* dataMan = [[DataManager alloc] init]; DataManager* dataMan = [[DataManager alloc] init];
Settings *currentSettings = [dataMan retrieveSettings]; Settings *currentSettings = [dataMan retrieveSettings];
currentSettings.settingsMenuMode = [NSNumber numberWithInteger:currentSettingsMenuMode]; currentSettings.settingsMenuMode = [NSNumber numberWithInteger:currentSettingsMenuMode];