tweak menu section header

This commit is contained in:
True Zhuanjia
2026-03-09 12:09:06 +08:00
parent 4a9e7ad2a1
commit e067fd8fa2
4 changed files with 19 additions and 15 deletions
+6 -4
View File
@@ -17,6 +17,7 @@
@property (nonatomic, strong) UIButton *toggleArea;
@property (nonatomic, strong) NSLayoutConstraint *heightConstraint;
@property (nonatomic, strong) UIView *headerView;
@property (assign) CGFloat titleOffset;
@end
@@ -61,6 +62,7 @@ static BOOL overridePersistedFoldState = YES;
_subStackViews = [NSMutableArray array];
_headerViewHeight = 37;
_headerViewVerticalSpacing = 25;
_titleOffset = 41.5;
// 设置视图
self.layer.cornerRadius = 10.0;
@@ -83,7 +85,7 @@ static BOOL overridePersistedFoldState = YES;
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = _sectionTitle;
_titleLabel.accessibilityIdentifier = @"menuSectionTitleLabel";
_titleLabel.font = [UIFont systemFontOfSize:19 weight:UIFontWeightSemibold];
_titleLabel.font = [UIFont systemFontOfSize:19.5 weight:UIFontWeightMedium];
_titleLabel.textColor = [ThemeManager textColor];
_titleLabel.textAlignment = NSTextAlignmentLeft;
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
@@ -146,7 +148,7 @@ static BOOL overridePersistedFoldState = YES;
// 标题约束
if(@available(iOS 13.0, *)){
[NSLayoutConstraint activateConstraints:@[
[_titleLabel.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:39],
[_titleLabel.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:_titleOffset],
[_titleLabel.centerYAnchor constraintEqualToAnchor:_headerView.centerYAnchor],
[_titleLabel.trailingAnchor constraintEqualToAnchor:_toggleButton.leadingAnchor constant:-8]
]];
@@ -191,7 +193,7 @@ static BOOL overridePersistedFoldState = YES;
[_separatorLine.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
[_separatorLine.widthAnchor constraintEqualToAnchor:self.widthAnchor constant:-5], // //mark: settingMenuLayout
[_separatorLine.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
[_separatorLine.heightAnchor constraintEqualToConstant:0.7]
[_separatorLine.heightAnchor constraintEqualToConstant:GenericUtils.menuSectionSeparatorWidth]
]];
[NSLayoutConstraint activateConstraints:@[
@@ -220,7 +222,7 @@ static BOOL overridePersistedFoldState = YES;
// 图标约束
[NSLayoutConstraint activateConstraints:@[
[_iconImageView.centerXAnchor constraintEqualToAnchor:_headerView.leadingAnchor constant:_leadingTrailingPadding+_headerViewHeight/2-3],
[_iconImageView.centerYAnchor constraintEqualToAnchor:_headerView.centerYAnchor constant:-0.5],
[_iconImageView.centerYAnchor constraintEqualToAnchor:_headerView.centerYAnchor constant:-0],
[_iconImageView.widthAnchor constraintEqualToConstant:_headerViewHeight+constant],
[_iconImageView.heightAnchor constraintEqualToConstant:_headerViewHeight+constant]
]];
+2
View File
@@ -59,4 +59,6 @@ import Foundation
}
}()
@objc static let menuSeparatorWidth: CGFloat = 0.7
@objc static let menuSectionSeparatorWidth: CGFloat = 0.7
}
@@ -938,7 +938,7 @@ const int FrontViewPositionNone = 0xff;
[_separatorLine.bottomAnchor constraintEqualToAnchor:_contentView.bottomAnchor constant:0],
//[_separatorLine.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:self.bounds.size.width-60],
[_separatorLine.leadingAnchor constraintEqualToAnchor:_contentView.frontView.leadingAnchor constant:0],
[_separatorLine.trailingAnchor constraintEqualToAnchor:_contentView.frontView.leadingAnchor constant:0.7], //mark: settingMenuLayout
[_separatorLine.trailingAnchor constraintEqualToAnchor:_contentView.frontView.leadingAnchor constant:GenericUtils.menuSeparatorWidth], //mark: settingMenuLayout
]];
}
@@ -790,7 +790,7 @@ BOOL isCustomResolution(int resolutionSelected) {
videoSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Video"];
videoSection.identifier = @"SettingsSectionVideo";
if (@available(iOS 13.0, *)) {
[videoSection setSectionWithIcon:[UIImage systemImageNamed:@"waveform"] size:13 sizeConstraint:-17];
[videoSection setSectionWithIcon:[UIImage systemImageNamed:@"waveform"] size:13 sizeConstraint:-15];
}
[self addSetting:self.resolutionStack ofId:@"resolutionStack" withInfoTag:NO withDynamicLabel:YES to:videoSection];
[self addSetting:self.fpsStack ofId:@"fpsStack" withInfoTag:NO withDynamicLabel:NO to:videoSection];
@@ -812,7 +812,7 @@ BOOL isCustomResolution(int resolutionSelected) {
touchControlSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Touch Control"];
touchControlSection.identifier = @"SettingsSectionTouch&Controller";
if (@available(iOS 13.0, *)) {
[touchControlSection setSectionWithIcon:[UIImage imageNamed:@"arcade.stick.console"] size:22 sizeConstraint:-15];
[touchControlSection setSectionWithIcon:[UIImage imageNamed:@"arcade.stick.console"] size:22 sizeConstraint:-13];
}
[self addSetting:self.touchModeStack ofId:@"touchModeStack" withInfoTag:YES withDynamicLabel:NO to:touchControlSection];
[self addSetting:self.mousePointerVelocityStack ofId:@"mousePointerVelocityStack" withInfoTag:NO withDynamicLabel:YES to:touchControlSection];
@@ -836,7 +836,7 @@ BOOL isCustomResolution(int resolutionSelected) {
controllerSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Controller"];
controllerSection.identifier = @"SettingsSectionController";
if (@available(iOS 13.0, *)) {
[controllerSection setSectionWithIcon:[UIImage systemImageNamed:@"gamecontroller"] size:30 sizeConstraint:-12];
[controllerSection setSectionWithIcon:[UIImage systemImageNamed:@"gamecontroller"] size:30 sizeConstraint:-10];
}
[self addSetting:self.swapAbxyStack ofId:@"swapAbaxyStack" withInfoTag:NO withDynamicLabel:NO to:controllerSection];
[self addSetting:self.hapticEngineStack ofId:@"hapticEngineStack" withInfoTag:NO withDynamicLabel:NO to:controllerSection];
@@ -854,7 +854,7 @@ BOOL isCustomResolution(int resolutionSelected) {
motionControlSection.delegate = self;
motionControlSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Motion Control"];
motionControlSection.identifier = @"SettingsSectionMotionControl";
if (@available(iOS 13.0, *)) [motionControlSection setSectionWithIcon:[UIImage imageNamed:@"gyroscope"] size:23 sizeConstraint:-20];
if (@available(iOS 13.0, *)) [motionControlSection setSectionWithIcon:[UIImage imageNamed:@"gyroscope"] size:23 sizeConstraint:-18];
[self addSetting:self.controllerGyroSwitchButtonStack ofId:@"controllerGyroSwitchButtonStack" withInfoTag:YES withDynamicLabel:YES to:motionControlSection];
[self addSetting:self.reverseHoldButtonStack ofId:@"reverseHoldButtonStack" withInfoTag:YES withDynamicLabel:YES to:motionControlSection];
[self addSetting:self.mapGyroToStack ofId:@"mapGyroToStack" withInfoTag:YES withDynamicLabel:NO to:motionControlSection];
@@ -879,7 +879,7 @@ BOOL isCustomResolution(int resolutionSelected) {
pencilSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Drawing Toolkit"];
pencilSection.identifier = @"SettingsSectionPencil";
if (@available(iOS 13.0, *)) {
[pencilSection setSectionWithIcon:[UIImage systemImageNamed:@"pencil.and.outline"] size:19 weight:UIImageSymbolWeightHeavy sizeConstraint:-17.5];
[pencilSection setSectionWithIcon:[UIImage systemImageNamed:@"pencil.and.outline"] size:19 weight:UIImageSymbolWeightHeavy sizeConstraint:-16.5];
}
[self addSetting:self.pencilTickStack ofId:@"pencilTickStack" withInfoTag:YES withDynamicLabel:NO to:pencilSection];
[self addSetting:self.pencilTickIntervalStack ofId:@"pencilTickIntervalStack" withInfoTag:NO withDynamicLabel:YES to:pencilSection];
@@ -898,7 +898,7 @@ BOOL isCustomResolution(int resolutionSelected) {
gesturesSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Gestures"];
gesturesSection.identifier = @"SettingsSectionGestures";
if (@available(iOS 13.0, *)) {
[gesturesSection setSectionWithIcon:[UIImage systemImageNamed:@"hand.draw"] size:23 sizeConstraint:-13.3];
[gesturesSection setSectionWithIcon:[UIImage systemImageNamed:@"hand.draw"] size:23 sizeConstraint:-11.3];
}
[self addSetting:self.softKeyboardGestureStack ofId:@"softKeyboardGestureStack" withInfoTag:YES withDynamicLabel:NO to:gesturesSection];
@@ -914,7 +914,7 @@ BOOL isCustomResolution(int resolutionSelected) {
peripheralSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Peripherals"];
peripheralSection.identifier = @"SettingsSectionPeripherals";
if (@available(iOS 13.0, *)) {
[peripheralSection setSectionWithIcon:[UIImage imageNamed:@"cable.connector.video"] size:20 sizeConstraint:-17.9];
[peripheralSection setSectionWithIcon:[UIImage imageNamed:@"cable.connector.video"] size:20 sizeConstraint:-16.9];
}
if (@available(iOS 13.0, *)) {
[self addSetting:self.externalDisplayModeStack ofId:@"externalDisplayModeStack" withInfoTag:YES withDynamicLabel:NO to:peripheralSection];
@@ -932,7 +932,7 @@ BOOL isCustomResolution(int resolutionSelected) {
audioSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Audio"];
audioSection.identifier = @"SettingsSectionAudio";
if (@available(iOS 13.0, *)) {
[audioSection setSectionWithIcon:[UIImage imageNamed:@"speaker.wave.2"] size:20 sizeConstraint:-16.7];
[audioSection setSectionWithIcon:[UIImage imageNamed:@"speaker.wave.2"] size:20 sizeConstraint:-15.7];
}
[self addSetting:self.audioOnPcStack ofId:@"audioOnPcStack" withInfoTag:NO withDynamicLabel:NO to:audioSection];
@@ -954,7 +954,7 @@ BOOL isCustomResolution(int resolutionSelected) {
otherSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Others"];
otherSection.identifier = @"SettingsSectionOthers";
if (@available(iOS 13.0, *)) {
[otherSection setSectionWithIcon:[UIImage systemImageNamed:@"cube"] size:20.5 sizeConstraint:-17];
[otherSection setSectionWithIcon:[UIImage systemImageNamed:@"cube"] size:19.5 sizeConstraint:-17];
}
[self addSetting:self.statsOverlayStack ofId:@"statsOverlayStack" withInfoTag:NO withDynamicLabel:NO to:otherSection];
[self addSetting:self.unlockDisplayOrientationStack ofId:@"unlockDisplayOrientationStack" withInfoTag:YES withDynamicLabel:NO to:otherSection];
@@ -974,7 +974,7 @@ BOOL isCustomResolution(int resolutionSelected) {
experimentalSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Experimental"];
experimentalSection.identifier = @"SettingsSectionExperimental";
if (@available(iOS 13.0, *)) {
[experimentalSection setSectionWithIcon:[UIImage imageNamed:@"flask"] size:20 sizeConstraint:-19];
[experimentalSection setSectionWithIcon:[UIImage imageNamed:@"flask"] size:19 sizeConstraint:-19];
}
[self addSetting:self.touchModeStack2 ofId:@"touchModeStack2" withInfoTag:NO withDynamicLabel:NO to:experimentalSection];